How to set the base path in IIS 7 hosting a WCF ap

2019-08-25 01:38发布

问题:

I've been fighting my way through the process of migrating a (previously self-hosted) WCF application to IIS7 (I've never used IIS before and I realise that this is a very simplistic question but I failed to google/SO the answer so far).

My service is hosted at http://xxx.xxx.xxx.xxx/SampleWebsite/Service.svc but when I access it with ?wsdl all the references that should read http://xxx.xxx.xxx.xxx/ are actually set to the window machine's local network name (i.e. http://localpc3/).

I've tried using the WCF tool to add the external IP address to the base address section under the service I'm configuring as well as a number of settings inside IIS manager but I can't seem to track down the correct place.

Where do I set this? IIS manager, web.config, somewhere else?


May be a duplicate:
WCF not using my domain name


Answer:

Change it in the metabase:

cscript.exe %systemdrive%\inetpub\adminscripts\adsutil.vbs 
      set W3SVC/your_website_identifier_here/ServerBindings ":80:myserver.example.com" 

回答1:

Yes, you have to modify the IIS Metabase. See here:

http://gavinmckay.wordpress.com/2009/03/24/howto-fix-wcf-host-name-on-iis/



标签: .net wcf iis iis-7