Hosting WCF in IIS 7.0 / Windows 2008

by Mikael Henriksson 25. November 2009 11:57

If found this to be helpful

  1. Run an elevated command prompt
  2. Run the following command:
    "%windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r -y
  3. Last and also very important is the need for a base address, it seems IIS 7 does not figure this out by itself:
  4. <system.serviceModel>
    	<services>
    		<service name="RESTService.Service" 
    				 behaviorConfiguration="Default">
    			<host>
    				<baseAddresses>
    					<add baseAddress="http://localhost:80/" />
    				</baseAddresses>
    			</host>
    			<endpoint address="" 
    					  behaviorConfiguration="Default" 
    					  binding="webHttpBinding" 
    					  contract="RESTService.Service" />
    		</service>
    	</services>
    </system.serviceModel>

Just speficy the baseAddress and you should be good to go. Navigate to your svc file and you can start consuming it.

Tags:

WCF | Windows Server

blog comments powered by Disqus