Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi.
I wrote a test public chat service with WCF
I have tested the service in IIS and it worked correctly. But when I upload it to my web site on internet, the service does not work.

my service Web.Config:
XML
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <customErrors mode="Off"/>
  </system.web>
  <system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="True">
    </serviceHostingEnvironment>
    <bindings >
      <wsDualHttpBinding>
        <binding name="wsDualHttp">
          <security mode="None">
            <message  clientCredentialType="None" algorithmSuite="Default" />
          </security>
        </binding>       
     </wsDualHttpBinding>
    </bindings>
    <protocolMapping>
      <add scheme="http" binding="wsDualHttpBinding" bindingConfiguration="wsDualHttp" />
    </protocolMapping>
    <services>
      <service behaviorConfiguration="ChatServiceBehavior" name="ServerChat.ChatService">
        <endpoint name="wsDualHttpBinding_ISendChatService" binding="wsDualHttpBinding" bindingConfiguration="wsDualHttp"
          contract="ServerChat.ISendChatService">
        </endpoint>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ChatServiceBehavior">
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="False"/>
          <useRequestHeadersForMetadataAddress />
          <dataContractSerializer />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>



my client is windows application
clinet app.Config:
XML
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <wsDualHttpBinding>
                <binding name="wsDualHttpBinding_ISendChatService" sendTimeout ="00:00:15">
                    <security mode="None" />
                </binding>
            </wsDualHttpBinding>
        </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ChatServiceBehavior">
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="False"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
        <client>
            <endpoint address="http://MySite.com/ChatService.svc"
                binding="wsDualHttpBinding" bindingConfiguration="wsDualHttpBinding_ISendChatService"
                contract="ChatServerService.ISendChatService" name="wsDualHttpBinding_ISendChatService">
                <identity>
                    <dns value="http://MySite.com" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>


and windows firewall is Off!!

Exception:

An unhandled exception of type 'System.TimeoutException' occurred in mscorlib.dll

Additional information: The open operation did not complete within the allotted timeout of 00:00:14.9969956. The time allotted to this operation may have been a portion of a longer timeout.

StackTrace:


Server stack trace:
at System.ServiceModel.Channels.ReliableRequestor.ThrowTimeoutException()
at System.ServiceModel.Channels.ReliableRequestor.Request(TimeSpan timeout)
at System.ServiceModel.Channels.ClientReliableSession.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ClientReliableDuplexSessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at ClientChat.ChatServerService.ISendChatService.Start(String Name)
at ClientChat.ChatServerService.SendChatServiceClient.Start(String Name) in d:\Project\My\Test\ClientChat\ClientChat\Service References\ChatServerService\Reference.cs:line 71
at ClientChat.ReceiveClient.Start(ReceiveClient rc, String name) in d:\Project\My\Test\ClientChat\ClientChat\ReceiveClient.cs:line 25
at ClientChat.Form1.btnLogin_Click(Object sender, EventArgs e) in d:\Project\My\Test\ClientChat\ClientChat\Form1.cs:line 50
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ClientChat.Program.Main() in d:\Project\My\Test\ClientChat\ClientChat\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Please Help me!! :(
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900