我在WCF Service Library
中创建了VS2012
并将其加载到我当地的IIS
。
我的客户端是Windows-Mobile 6.5
设备,客户端的配置文件是使用netcfsvcutil.exe
生成的。在调试期间,一切工作都很顺利但是当我将服务上传到外部IIS
时,即使There was no endpoint listening...
从外部URL生成了文件,我仍然会收到netcfsvcutil.exe
异常。这是位于远程服务器上的web.config
文件:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="TestBinding" receiveTimeout="00:01:00" sendTimeout="00:01:00">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="MyService.CollectionService">
<endpoint address="" binding="basicHttpBinding" contract="MyService.ICollectionService" bindingConfiguration="TestBinding">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/MyService/CollectionService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
,客户端端点生成如下:
public static System.ServiceModel.EndpointAddress EndpointAddress =
new System.ServiceModel.EndpointAddress("http://1.2.3.4/MyService/MyService.CollectionService.svc");
当我将服务上传到外部IIS
时,我没有进行任何配置更改,我只是复制了&amp;将文件从一个虚拟目录粘贴到另一个虚拟目录。
可能有帮助的一点是异常是在没有任何超时的情况下引发的。
答案 0 :(得分:1)
基地址路径和端口与客户端配置中的端点地址不匹配。
您的配置中的地址:http://localhost:8733/Design_Time_Addresses/MyService/CollectionService/"
您的终端中的地址:
http://1.2.3.4/MyService/MyService.CollectionService.svc
您需要将端点代码更改为
public static System.ServiceModel.EndpointAddress EndpointAddress = new System.ServiceModel.EndpointAddress("http://1.2.3.4:8733/Design_Time_Addresses/MyService/CollectionService");