我正在VS2010中開發一個WCF應用程序。當我使用in-IDE調試器來運行主機應用程序和客戶端時,一切都按預期運行。WCF SocketException
然而,當我手動運行兩個可執行文件(去到/ bin /調試/文件夾),我從客戶端得到下面的異常:
System.Net.Sockets.SocketException:無法連接因爲目標機器積極地拒絕它127.0.0.1:8732
奇怪的是,在app.config文件我指定使用的端口是5000,不是8732.
有什麼不對?先謝謝你。
編輯:這裏是主機應用程序的app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="WCFServiceLibrary.SavalotServiceObject">
<endpoint address="" binding="wsHttpBinding" contract="WCFServiceLibrary.ISavalotService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:5000/Design_Time_Addresses/WCFServiceLibrary/SavalotServiceObject/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
按下ctrl + F5並在未進行調試的情況下運行 – deltree 2012-03-14 21:16:47
@deltree會發生什麼相同的錯誤。 – Xenoprimate 2012-03-14 21:23:57
那麼你的問題是你的配置文件中有調試特定的設置。 – deltree 2012-03-14 21:25:12