我使用WCF發現創建了一項服務。一切工作正常,當它被部署在一個特定的端口(使用VS2010調試),但是當我嘗試將其部署到IIS時,它找到該服務,但無法運行任何方法。調用WCF客戶端功能在IIS上不起作用
這是代碼:
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();
當特林運行client.getMsg()
方法我收到以下錯誤:
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.
但我得到的地址,這意味着它發現它。如果我使用調試部署器(不是iis),我在http://localhost:port/services/Service.svc
中找到它,它運行得非常好。我怎樣才能將它部署到iis而沒有任何問題?
操作系統:WIN7 64位
配置文件:
<services>
<service behaviorConfiguration="RemoteDeploy.Service1Behavior"
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>
P也許你需要添加svc映射到IIS? (ServiceModelReg.exe -i) – sternr
您可以發佈您的web.config文件,至少在您配置端點的位置。使用WCF服務的次數超過了,所有問題都與其配置有關。 – AJC