无法从另一台计算机访问Windows服务

时间:2012-09-03 05:14:04

标签: .net wcf web-services

我有一个带有以下配置文件的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/MyService

但是,如果我尝试从另一台机器访问,则根本无法访问。 Telnet到端口8081也失败了。我也禁用了防火墙,但仍然没有线索。

我正在使用Windows Server 2008 R2。

任何人都可以告诉我如何从其他机器访问此服务?

谢谢!

1 个答案:

答案 0 :(得分:1)

查看http://msdn.microsoft.com/en-us/library/ms733749.aspx,您可能需要在the <endpoint> element中的地址属性末尾包含该端口。否则,标题&#34;定义服务地址&#34; http://msdn.microsoft.com/en-us/library/aa751841部分可能有帮助。

该示例还包括行<add key="Port" value="8080"/>。那应该是8081还是不相关?