简体   繁体   中英

WCF hosting in Windows Services (Network Service)

  1. WCF Service
  2. WCF service hosting in Windows Services
  3. WinService log on as Network Service

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 was OK. I installed my client and tried to connect to my remote service, but connect failed. telnet also can't establish connection.

What is wrong?

Firewalls are disconnected. (on both sides)

On the client side telnet cant open connection to IP PORT

There is no problem with windows service or 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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