开发者

calling WCF client function doesn't work on IIS

I made a service using the WCF discovery. Everything works fine when it is deployed on a specific port (using VS2010 debug), but when I try to deploy it to IIS it finds the service but can't run any of the methods.

This is the code:

 DiscoveryClient discoverclient = new DiscoveryClient(new UdpDiscoveryEndpoint());
 FindResponse response = discoverclient.Find(new FindCriteria(typeof(IService)));
 EndpointAddress address = response.Endpoints[0].Address;
 ServiceClient client = new ServiceClient(new BasicHttpBinding(), address);
 Console.WriteLine(client.getMsg()); //some test function
 Console.ReadKey();

When tring to run the client.getMsg() method I get the following error:

EndpointNotFoundException:

There was no endpoint listening at http://computerName.domain/services/Service.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

But I got the address, meaning it found it. And if I use the debug deployer (not to iis) I find it in http://localhost:port/services/Service.svc and it runs perfectly fine. How can I have it deployed to iis with no problems?

OS : win7 64 bit

config file :

<services>
  <service behaviorConfiguration="RemoteDeploy.Service1Behav开发者_运维问答ior"
    name="RemoteDeploy.Service">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration=""
      contract="RemoteDeploy.IService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint name="udpDiscoveryEpt" kind="udpDiscoveryEndpoint" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>

</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="RemoteDeploy.Service1Behavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
      <serviceDiscovery>

        </serviceDiscovery>
    </behavior>
  </serviceBehaviors>
</behaviors>


First try to GET http://computerName.domain/services/Service.svc in your browser - either you get an error or service description..

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜