简体   繁体   English

Windows Services(网络服务)中的WCF托管

[英]WCF hosting in Windows Services (Network Service)

  1. WCF Service WCF服务
  2. WCF service hosting in Windows Services Windows Services中的WCF服务托管
  3. WinService log on as Network Service WinService作为网络服务登录

Host app config : 主机应用程序配置:

<service name="StudyingControllerService.ControllerService">
        <host>
          <baseAddresses>
            <add baseAddress="http://IP:PORT/ControllerService.svc"/>
          </baseAddresses>
        </host>
        <endpoint address=""
                  binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IControllerService"
                  contract="StudyingControllerService.IControllerService" />
      </service>

Everything work fine in local network. 在本地网络中一切正常。 (localhost) But I want to access my service from another computers via network. (本地主机),但是我想通过网络从另一台计算机访问我的服务。

I used another computer(from another localation), did ping IP (winservice's). 我使用了另一台计算机(来自其他位置),对ping IP(winservice的IP)进行了ping操作。 ping was OK. ping还可以。 I installed my client and tried to connect to my remote service, but connect failed. 我安装了客户端,并尝试连接到远程服务,但是连接失败。 telnet also can't establish connection. telnet也无法建立连接。

What is wrong? 怎么了?

Firewalls are disconnected. 防火墙已断开连接。 (on both sides) (双方)

On the client side telnet cant open connection to IP PORT 在客户端telnet无法打开与IP PORT的连接

There is no problem with windows service or WCF. Windows服务或WCF没有问题。 Problem was with my internet provider. 问题出在我的互联网提供商上。

It blocked port which used my service. 它阻塞了使用我服务的端口。 So, I ask to administrator to open port. 因此,我要求管理员打开端口。 and now everything is OK. 现在一切正常。

Thanks all for answers. 谢谢大家的回答。

I had a similar issue. 我有一个类似的问题。 It was just abut opening the PORT on windows firewall. 只是在Windows防火墙上打开PORT。

Just to test if that would work, i turned off the firewall service. 只是为了测试是否可行,我关闭了防火墙服务。

Hope that helps! 希望有帮助!

I would try changing your base address in your config file, as follows: 我会尝试在您的配置文件中更改您的基本地址,如下所示:

<service name="StudyingControllerService.ControllerService">
  <host>
    <baseAddresses>
      <add baseAddress="http://IP:PORT"/>
    </baseAddresses>
  </host>
  <endpoint address="ControllerService.svc"
            binding="basicHttpBinding"
            bindingConfiguration="BasicHttpBinding_IControllerService"
            contract="StudyingControllerService.IControllerService" />
</service>

My reason for recommending this is that the base address is used to allow endpoints to be added relative to the base address - putting the endpoint in the base address may be causing the issue. 我建议这样做的原因是,基地址用于允许相对于基地址添加端点-将端点置于基地址中可能会引起问题。

Something to try at least - a couple minutes of editing and you'll have an answer one way or the other. 至少要尝试一下-几分钟的编辑,您将以一种或另一种方式获得答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM