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/MyService 访问它

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

我正在使用 Windows Server 2008 R2。

谁能告诉我如何从其他机器访问此服务?

谢谢!

4

1 回答 1

1

查看http://msdn.microsoft.com/en-us/library/ms733749.aspx ,您可能需要<endpoint>元素的地址属性末尾包含端口。否则,http: //msdn.microsoft.com/en-us/library/aa751841上的标题“为服务定义地址”部分可能会有所帮助。

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

于 2012-09-03T05:40:29.537 回答