У меня есть служба обнаружения wcf, называемая «GetNameService», которая размещена на ПК @ 10.0.0.5:8732. Он размещен с wsHttpBinding и доступен для обнаружения через UdpEndpoint. У меня также есть клиент @ 10.0.0.9, который обнаруживается для таких сервисов в той же сети. Когда я запускал клиента, я могу открыть службу, но конечная точка обнаруженной службы имеет в ней локальный хост. Как это может произойти, пожалуйста, помогите мне в этом.WCF обнаружение находит конечную точку, но адрес localhost
Некоторые больше информации,
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 доступна и система подключения через»коммутатор, где, как он не работает в моем дома, где ПК подключаются через «маршрутизатор». Может ли это повлиять на что-то?!?
Update Это не работает в IIS, она прошла через»обычное приложение консоли
Он не размещен на IIS, размещенных через»консольное приложение – sudarsanyes