powered by simpleCommunicator - 2.0.59     © 2025 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / WCF как развернуть приложение в локальной сети
7 сообщений из 7, страница 1 из 1
WCF как развернуть приложение в локальной сети
    #36629719
Здравствуйте

Имеется приложение c self-hosted WCF-сервисом
К этому приложению по локальной сети должны подключаться клиенты.

Как это сделать?

Ниже код конфиг файла(приложение с сервисом):
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicBinding"
maxReceivedMessageSize="2097151"
transferMode="Streamed"/>
</basicHttpBinding>
</bindings>

<behaviors>
<serviceBehaviors>
<behavior name="contest.contestServiceBehavior">
<serviceMetadata httpGetEnabled="true"
httpGetUrl="http://localhost:8731/contest/contestService/"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="contest.photoServiceBehavior">
<serviceMetadata httpGetEnabled="true"
httpGetUrl="http://localhost:8731/contest/photoService/"/>
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="contest.contestServiceBehavior"
name="contest.contestService">
<endpoint address="http://localhost:8732/contest/contestService/"
binding="wsDualHttpBinding"
contract="contest.IcontestService"
name="wsDualHttpBinding">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/contest/contestService/"/>
</baseAddresses>
</host>
</service>

<service behaviorConfiguration="contest.photoServiceBehavior"
name="contest.photoService">
<endpoint address="http://localhost:8732/contest/photoService/"
binding="basicHttpBinding" bindingConfiguration="basicBinding"
contract="contest.IphotoService"
name="basicHttpBinding">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/contest/photoService/" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>


IP-адрес компа(там где WCF сервис) = 192.168.249.7
Код конфиг файла(клиента):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="WeakWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="2097151"
messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
useDefaultWebProxy=" true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<wsDualHttpBinding>
<binding name="wsDualHttpBinding" closeTimeout="00:00:10" openTimeout="00:00:10"
receiveTimeout="00:10:00" sendTimeout="00:00:10" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="WeakWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="None">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>

<client>
<endpoint address="http://192.168.249.7:8732/contest/contestService/"
binding="wsDualHttpBinding" bindingConfiguration="wsDualHttpBinding"
contract="contestServiceReference.IcontestService" name="wsDualHttpBinding">
<identity>
<dns value="192.168.249.7" />
</identity>
</endpoint>
<endpoint address="http://192.168.249.7:8732/contest/photoService/"
binding="basicHttpBinding" bindingConfiguration="basicHttpBinding"
contract="photoServiceReference.IphotoService" name="basicHttpBinding">
<identity>
<dns value="192.168.249.7" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
...
Рейтинг: 0 / 0
WCF как развернуть приложение в локальной сети
    #36631407
AlexeiK
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Azamat Bekmurat uulu,

слушай, друг, ты отформатируй,так чтобы читать было удобнее. а то уж..
...
Рейтинг: 0 / 0
WCF как развернуть приложение в локальной сети
    #36631587
Фотография D129
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
<identity>
<dns value="192.168.249.7" />
</identity>

вот подобное - уберите нафиг.
Это означает, что клиент может только с этого адреса подключитсья.
Иногда туда же лезет имя пользователя или компьютера. Тогда означает - только этот может использовать сервис.

В принципе, можно наоборот - расширить список, добавить все айпишники всех разрешенных клиентов.
...
Рейтинг: 0 / 0
WCF как развернуть приложение в локальной сети
    #36633216
AlexeiK
слушай, друг, ты отформатируй,так чтобы читать было удобнее. а то уж..
ниже наверно будет получше...
...
Рейтинг: 0 / 0
WCF как развернуть приложение в локальной сети
    #36633219
Имеется приложение c self-hosted WCF-сервисом
К этому приложению по локальной сети должны подключаться клиенты.

Как это сделать?

Ниже код конфиг файла(приложение с сервисом):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicBinding"
maxReceivedMessageSize="2097151"
transferMode="Streamed"/>
</basicHttpBinding>
</bindings>

<behaviors>
<serviceBehaviors>
<behavior name="contest.contestServiceBehavior">
<serviceMetadata httpGetEnabled="true"
httpGetUrl="http://localhost:8731/contest/contestService/"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>

<behavior name="contest.photoServiceBehavior">
<serviceMetadata httpGetEnabled="true"
httpGetUrl="http://localhost:8731/contest/photoService/"/>
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>

<services>
<service behaviorConfiguration="contest.contestServiceBehavior"
name="contest.contestService">
<endpoint address="http://localhost:8731/contest/contestService/"
binding="wsDualHttpBinding"
contract="contest.IcontestService"
name="wsDualHttpBinding">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/contest/contestService/"/>
</baseAddresses>
</host>
</service>

<service behaviorConfiguration="contest.photoServiceBehavior"
name="contest.photoService">
<endpoint address="http://localhost:8731/contest/photoService/"
binding="basicHttpBinding" bindingConfiguration="basicBinding"
contract="contest.IphotoService"
name="basicHttpBinding">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/contest/photoService/" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>


IP-адрес компа(там где WCF сервис) = 192.168.249.7
Код конфиг файла(клиента):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="WeakWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="2097151"
messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
useDefaultWebProxy=" true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<wsDualHttpBinding>
<binding name="wsDualHttpBinding" closeTimeout="00:00:10" openTimeout="00:00:10"
receiveTimeout="00:10:00" sendTimeout="00:00:10" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="WeakWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="None">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>

<client>
<endpoint address="http://192.168.249.7:8731/contest/contestService/"
binding="wsDualHttpBinding" bindingConfiguration="wsDualHttpBinding"
contract="contestServiceReference.IcontestService" name="wsDualHttpBinding">
<identity>
<dns value="192.168.249.7" />
</identity>
</endpoint>
<endpoint address="http://192.168.249.7:8731/contest/photoService/"
binding="basicHttpBinding" bindingConfiguration="basicHttpBinding"
contract="photoServiceReference.IphotoService" name="basicHttpBinding">
<identity>
<dns value="192.168.249.7" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
...
Рейтинг: 0 / 0
WCF как развернуть приложение в локальной сети
    #36633221
D129
спасибо. Сегодня попробую
...
Рейтинг: 0 / 0
WCF как развернуть приложение в локальной сети
    #36635439
D129
Бооольшое спасибо. Работает!
...
Рейтинг: 0 / 0
7 сообщений из 7, страница 1 из 1
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / WCF как развернуть приложение в локальной сети
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]