none
Setting up config file properly for wcf RRS feed

  • Question

  • I developed a windows service using wcf and deployed it on my local dev machine.  I then created a web page to communicate with the service and display statuses and allow for stopping the service.  This all works great.  Now I've moved both to production and they can't see each other or the endpoints are not set up correctly. Not sure which.

    Both servers (web app and windows service server) are on the same domain.  I've changed my web.config entries from localhost to what is below. Can someone take a look and verify this is correct?   

    Also, the windows service is running under the local system account. Would that cause issues in connecting out to the web server?

    On windows service server:

    <bindings>
    <netTcpBinding>
    <binding name="NetTcpBindingEndPoint" closeTimeout="00:00:05"
    openTimeout="00:00:05" sendTimeout="00:00:05" />
    </netTcpBinding>
    </bindings>

    <client>
    <endpoint address="net.tcp://mywebservername:8443/LabParserService/LabService/"
            binding="netTcpBinding" bindingConfiguration="NetTcpBindingEndPoint"
            contract="LabParserServiceRef.ILabService" name="NetTcpBindingEndPoint">
            <identity>
              <dns value="net.tcp://mywebservername:8443" />
            </identity>
          </endpoint>
       </client>

    On web server

    <netTcpBinding>
              <binding name="NetTcpBindingEndPoint" />
    </netTcpBinding>

     <endpoint address="net.tcp://mywindowsservername:8443/LabParserService/LabService/"
              binding="netTcpBinding" bindingConfiguration="NetTcpBindingEndPoint"
              contract="LabParserServiceRef.ILabService" name="NetTcpBindingEndPoint">
              <identity>
                <dns value="net.tcp://mywindowsservername:8443/" />
              </identity>
            </endpoint>

    Any suggestions would be appreciated.

    Thanks

    Monday, April 20, 2015 7:10 PM

Answers

  • Hi jmrut,

    Based on your description, I know that you have hosted your WCF Service on Windows Service and your client is a web page. So in my mind the Windows services server works as a Server side in this case, then it will be better if you can try to post the config file like <service>..</service> in the windows service server. And web page's config file should be like <client>..</client>.
    Please also try to make sure that the Windows Service is running when you consume the WCF Service, maybe you can try to use the NetworkService Account for the Windows Service to see if it works.
    Besides, please also try to check the following articles:
    #How to: Host a WCF Service in a Managed Windows Service:
    https://msdn.microsoft.com/en-us/library/ms733069(v=vs.110).aspx .
    #WCF Hosting with Windows Service:
    http://www.codeproject.com/Articles/653493/WCF-Hosting-with-Windows-Service .


    Best Regards,
    Amy Peng

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.




    Tuesday, April 21, 2015 5:53 AM
    Moderator
  • Hi jmrut,

    Based on your config file, I found in your service config your service endpoint address is:
    net.tcp://MYWEBSERVERNAME:8443/LabParserService/LabService/
    But in your client config file the client endpoint address is:
    net.tcp://SERVICESERVERNAME:8443/LabParserService/LabService/

    Please make sure that your client endpoint uses the same address as the service endpoint.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Monday, April 27, 2015 7:01 AM
    Moderator

All replies

  • Hi jmrut,

    Based on your description, I know that you have hosted your WCF Service on Windows Service and your client is a web page. So in my mind the Windows services server works as a Server side in this case, then it will be better if you can try to post the config file like <service>..</service> in the windows service server. And web page's config file should be like <client>..</client>.
    Please also try to make sure that the Windows Service is running when you consume the WCF Service, maybe you can try to use the NetworkService Account for the Windows Service to see if it works.
    Besides, please also try to check the following articles:
    #How to: Host a WCF Service in a Managed Windows Service:
    https://msdn.microsoft.com/en-us/library/ms733069(v=vs.110).aspx .
    #WCF Hosting with Windows Service:
    http://www.codeproject.com/Articles/653493/WCF-Hosting-with-Windows-Service .


    Best Regards,
    Amy Peng

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.




    Tuesday, April 21, 2015 5:53 AM
    Moderator
  • The windows service looks like this

    <services>
          <service name="LabParserService.LabService" behaviorConfiguration="LabParserService.MyServiceBehavior">
            <endpoint address="" binding="netTcpBinding" bindingConfiguration="" name="NetTcpBindingEndPoint" contract="LabParserService.ILabService">
              <identity>
                <dns value="MYWEBSERVERNAME" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexTcpBinding" name="MexTcpBindingEndpoint" contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="net.tcp://MYWEBSERVERNAME:8443/LabParserService/LabService/" />
              </baseAddresses>
            </host>
          </service>
        </services>

    website config:

    <client>
      <endpoint address="net.tcp://SERVICESERVERNAME:8443/LabParserService/LabService/"
            binding="netTcpBinding" bindingConfiguration="NetTcpBindingEndPoint"
            contract="LabParserServiceRef.ILabService" name="NetTcpBindingEndPoint">
            <identity>
              <dns value="SERVICESERVERNAME:8443" />
            </identity>
          </endpoint>
       </client>

    Tuesday, April 21, 2015 12:14 PM
  • Hi jmrut,

    Based on your config file, I found in your service config your service endpoint address is:
    net.tcp://MYWEBSERVERNAME:8443/LabParserService/LabService/
    But in your client config file the client endpoint address is:
    net.tcp://SERVICESERVERNAME:8443/LabParserService/LabService/

    Please make sure that your client endpoint uses the same address as the service endpoint.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Monday, April 27, 2015 7:01 AM
    Moderator