0

我创建了一个WCF Service LibraryinVS2012并将其加载到我的本地IIS.
我的客户端是一个Windows-Mobile 6.5设备,客户端的配置文件是使用netcfsvcutil.exe. 在调试过程中一切正常,但是当我将服务上传到外部时,即使从外部 URL 生成文件,IIS我仍然会收到异常。这是位于远程服务器上的文件:There was no endpoint listening...netcfsvcutil.exeweb.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,我只是将文件从一个虚拟目录复制并粘贴到另一个。可能有帮助的一些事情是在没有任何超时的情况下引发异常。

4

1 回答 1

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");
于 2013-06-20T14:22:54.357 回答