我有一個名爲「GetNameService」的wcf可發現服務,它位於PC @ 10.0.0.5:8732上。它使用wsHttpBinding進行託管,並可通過'UdpEndpoint發現。我也有一個client @ 10.0.0.9,它在同一個網絡中發現了這樣的服務。當我運行客戶端時,我能夠發現服務,但發現的服務的終點是有本地主機。這怎麼可能發生,請幫我解決這個問題。WCF發現找到端點,但地址是本地主機
一些詳細信息,
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="NameService.GetNameService">
<host>
<baseAddresses>
<add baseAddress = "http://10.0.0.5:8732/Design_Time_Addresses/NameService/GetNameService/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address ="" binding="wsHttpBinding" contract="NameService.IGetNameService">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</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>
我打開了在客戶機瀏覽器和輸入的服務地址,我能看到服務的詳細信息頁面,但仍然是WSDL鏈接指向本地主機(如下所示)
svcutil.exe的http://localhost:8732/Design_Time_Addresses/NameService/GetNameService/?wsdl
代替
svcutil.exe的http://10.0.0.5:8732/Design_Time_Addresses/NameService/GetNameService/?wsdl
此外,相同的應用程序似乎是在我工作的地方工作,那裏是一個DNS可與系統相連通」的開關,在那裏,因爲它沒有在我的工作通過路由器連接PC的家。這會影響一些東西嗎?!?
更新 這不是在IIS中運行,它託管直通」一個正常的控制檯應用程序
它不是託管在IIS,託管直通」一個控制檯應用程序 – sudarsanyes 2010-09-17 10:46:23