开发者

WCF service timing out

I have a plugin that exposes a wcf service. if I test this service using WCFStorm, everything works fine. I get a response right away. When I try to consume the service from the application that loaded the plugin I get a time out.

ProgrammingMaster_ServiceClient aClient = new ProgrammingMaster_ServiceClient();
aClient.Endpoint.Address = new EndpointAddress("http://localhost:8081/ProgrammingMaster/PM_Service");
aClient.BeginProgrammingSession(0x01);
aClient.Close();

Is the code i'm using to consume the service. ProgrammingMaster_SErviceClient is generated by svcutil.exe.

I get the same problem if i remove the line

aClient.Endpoint.Address = new EndpointAddress("http://localhost:8081/ProgrammingMaster/PM_Service");

I'm not really sure where I should be looking to start debugging this.

the service being called sends a message on a different network. When I call it through wcfstorm I can see the message being sent by the service. so i know the service works correctly.

What am i doing wrong when I call the service from my application that is causing a time out.

Edit: after the time out expires (I'm catching and logging the exception), the service sends its message on the other network like its supposed to.

Edit 2: Hopefully this is a better explanation.

So I have a plugin which exposes a web service, and consumes a different web service. So the plugin basically connects to an object on a special network, then passes that objects property values by consuming a web service.

I have an application which exposes the web service the plugin uses to give updates of the remote objects values, and consumes a web service exposed by the plugin to pass commands to the remote object.

There are no timeout issues when the plugin sends updates to the application. I'm getting a timeout error when the application uses the web service to send a command to the remote object via the plugin. After the timeout expires the command is executed. So the we开发者_如何学Gob service is being called successfully. I guess I'm just not getting a response back?

Edit 3: here is my app config file. I lowered the send timeout to 00:00:01 so that the wait isn't so long, but I'd really like to fix it so it doesn't have to timeout every time.

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IProgrammingMaster_Service" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:00:01" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
          <security mode="Message">
            <transport clientCredentialType="Windows" proxyCredentialType="None" realm="">
              <extendedProtectionPolicy policyEnforcement="Never"/>
            </transport>
            <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:8081/ProgrammingMaster/PM_Service" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IProgrammingMaster_Service" contract="IProgrammingMaster_Service" name="WSHttpBinding_IProgrammingMaster_Service">
        <identity>
          <userPrincipalName value="mzjkk7@nam.corp.gm.com"/>
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>
<startup useLegacyV2RuntimeActivationPolicy="true">
  <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>


Oh...

yes the time out only happens when the client and server are both part of the same application.

The important question is are the client and service running on the same thread?

If so, that's likely your problem. Try spinning up the service in its own thread and see if that sort out the problem.


Turn on the built in WCF debugging / logging features:

http://msdn.microsoft.com/en-us/library/ms733025.aspx

This has helped me sort out all sorts of oddball issues with WCF. Just remember to turn it off when you're done - it writes a lot of data to disk!


Have you tried it with your firewall turned off to see if that might be what's causing it?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜