简体   繁体   中英

Wcf service access and routing through IIS

I have a wcf self-hosted service running as windows service, serving multiple win/web clients in the local network. Service itself has multiple contracts (tcp & named pipes), one of which should be made available through IIS (any form of http binding) so it can be accessed from outside, like by simply accessing www.mypublicdomain.com/public-contract.svc

Current topology:

  • Server app - wcf windows service
  • Client app1 - win forms app - contacts server app via tcp/ip
  • Client app2 - mvc web app (available both internally and via internet though public domain) - contacts server app via named pipes (same machine)
    • this app is hosted on iis7 and new public wcf contract should be made public as part of this.
  • Shared assembly - contains interfaces (service contracts)

Question is - what's the best way to expose one of the contracts on the windows service via IIS, so all requests made to that publicly available service would be directly routed to backend windows service.

My first question of stackoverflow, if anything is unclear, i'll try to explain it further. Thank you.

I you are using IIS 7 then you can host the wcf service in IIS and expose one service contract with a HTTP binding, and the other non-public one as TCP-IP.

If you MUST host the server app as a windows service, then create a new IIS hosted service that has the same interface as the service contract you want public, but simply passes the calls through.

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