C# WCF windows服务是否支持内部网连接?

C# WCF windows服务是否支持内部网连接?,c#,wcf,intranet,C#,Wcf,Intranet,我是WCF的初学者。我尝试在IIS中托管我的WCF服务器,并且可以成功地在另一台计算机中访问该服务。当我改为在Windows服务中托管此WCF服务器时,我可以在本地访问,但在另一台计算机中失败。WCF支持这一点吗?如果有任何示例演示如何在Intranet中使用windows服务托管的WCF,将不胜感激 我已关闭两台计算机上的防火墙。 下面是我使用的服务配置: <system.serviceModel> <services> <service behavi

我是WCF的初学者。我尝试在IIS中托管我的WCF服务器,并且可以成功地在另一台计算机中访问该服务。当我改为在Windows服务中托管此WCF服务器时,我可以在本地访问,但在另一台计算机中失败。WCF支持这一点吗?如果有任何示例演示如何在Intranet中使用windows服务托管的WCF,将不胜感激

我已关闭两台计算机上的防火墙。 下面是我使用的服务配置:

<system.serviceModel>
  <services>
    <service behaviorConfiguration="Service" name="TestService.Test">
      <endpoint address="basic" binding="basicHttpBinding" name="basic" contract="TestService.ITest">
        <identity>
          <dns value="localhost"/>
        </identity>
      </endpoint>
      <endpoint address="mex" binding="mexHttpBinding" name="mex" contract="IMetadataExchange"/>
      <host>
        <baseAddresses>
          <add baseAddress="http://localhost:8080/TestService/"/>
        </baseAddresses>
      </host>
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior name="Service">
        <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
        <serviceDebug includeExceptionDetailInFaults="false"/>
      </behavior>
    </serviceBehaviors>
  </behaviors>

@拉胡尔,谢谢你的帮助。我终于成功了。在这里我粘贴了我的配置,希望能对遇到类似问题的人有所帮助。 将我的服务器配置更改为:

<system.serviceModel>
<bindings>
  <netTcpBinding>
    <binding name="tcpConfig">
      <security mode="None" />
    </binding>
  </netTcpBinding>
</bindings>
<services>
  <service behaviorConfiguration="Service" name="TestService.Test">
    <endpoint address="net.tcp://localhost:8081/Test" binding="netTcpBinding"
      bindingConfiguration="tcpConfig" name="tcp" contract="TestService.ITest" />
    <endpoint address="mex" binding="mexHttpBinding" name="mex" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8080/TestService/" />
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="Service">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

下面是我在另一台机器上运行的客户端配置:

<system.serviceModel>
    <bindings>
        <netTcpBinding>
            <binding name="tcp">
                <security mode="None" />
            </binding>
        </netTcpBinding>
    </bindings>
    <client>
        <endpoint address="net.tcp://192.168.209.132:8081/TestService" binding="netTcpBinding"
            bindingConfiguration="tcp" contract="TestServiceReference.ITest"
            name="tcp" />
    </client>
</system.serviceModel>


< /代码> 如果是Intranet服务,如果您选择部署为Windows服务,则考虑使用<代码> NETTCPBING/<代码>类似

binding="netTcpBinding"

也可以考虑使用适当的IPv4地址,而不是代码> LoalHoals< /Calp>

检查防火墙设置和配置,也不要首先在服务中运行它,制作一个测试应用程序,看看它是否从那里运行,调试更容易,这被称为降低自由度。如果你可以在本地而不是从另一台计算机上访问它,这看起来非常可疑,非常像防火墙或网络related@MichaelRandall,但情况并非如此,因为他可以在部署到IISIt时访问它,应该可以工作。