從IIS

2013-06-20 30 views
0
消耗WCF服務

我在VS2012中創建了一個WCF Service Library,並將其加載到我的本地IIS
我的客戶端是Windows-Mobile 6.5設備,客戶端的配置文件是使用netcfsvcutil.exe生成的。在調試過程中一切正常,但當我將服務上傳到外部IIS時,即使netcfsvcutil.exe從外部URL生成文件,我仍然收到There was no endpoint listening...例外。這是web.config文件所在的遠程服務器上:從IIS

<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,我只是複製&將文件從一個虛擬目錄粘貼到另一個。 可能有所幫助的一點是,異常在沒有超時的情況下引發。

回答

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");