1
我有一個窗口服務,下面的配置文件訪問Windows服務:無法從另一臺機器
<system.serviceModel>
<services>
<service behaviorConfiguration="ServiceBehavior" name="abc.MyService.MyService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration=""
contract="abc.MyService.MyService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="ServiceSoap" maxBufferSize="15000000" maxBufferPoolSize="524288" maxReceivedMessageSize="15000000">
<readerQuotas maxDepth="32" maxStringContentLength="30000" maxArrayLength="6291456" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="1000000" />
</behavior>
</serviceBehaviors>
</behaviors>
<client>
<endpoint binding="basicHttpBinding"
bindingConfiguration="ServiceSoap" contract="IMyProject">
</endpoint>
</client>
</system.serviceModel>
<appSettings>
<add key="WebServiceEndPoint" value="http://10.10.1.1:8081/MyService" />
<add key="ServerSDKLogLevel" value="5"/>
<add key="ServerSDKLogFileName" value="abc.log"/>
<add key="UseSSL" value="false"/>
<add key="Port" value="8080"/>
<add key="LogRetrievalInterval" value="56:00:00" />
<add key="ResetTimerThreshold" value="100"/>
<add key="DatabaseThreadsCount" value="10"/>
<add key="TaskManagerThreadsCount" value="10"/>
<add key="ClientAccessMaxQueue" value="20000"/>
</appSettings>
當我啓動服務,我可以在HTTP訪問:// 10.10.1.1:8081/我的服務
但是,如果我嘗試從另一臺機器訪問,則根本無法訪問。 Telnet到端口8081也失敗。我也禁用了防火牆,但仍然沒有任何線索。
我正在使用Windows Server 2008 R2。
任何人都可以告訴我如何從其他機器訪問此服務?
謝謝!
請發佈您用於啓動ServiceHost的代碼。你的配置文件不包括['baseAddress'](http://msdn.microsoft.com/en-us/library/ms789018.aspx),如果它在代碼中被設置爲涉及'localhost'的東西,這是可能的WCF只能監聽環回地址,而不是實際的網絡接口。 – shambulator