Question

This article doesn't use the standard WCF Service Library project template in VS2010, so apparently it lacks some things that might make it easier to host on IIS.

Can somebody please provide the steps necessary (and as much details as you care to include) to take this particular WCF solution to the stage where it is hosted on IIS 7?

Thanks.

Was it helpful?

Solution

  1. Create a folder at C:\intepub\wwwroot\Test
  2. The contents of the above folder would be as below a. bin folder b. a .svc file c. web.config file

Now from the article once your build the service class library project it would generate a .dll file that needs to be copied over to the bin folder.

Now create a .svc file with the below content:

<%@ServiceHost language=c# Debug="true" Service="TConvertAS.Services.TempConverter "%>

Now your web.config should look as below:

<?xml version="1.0" encoding="utf-8"?>
<configuration>     
  <system.web>    
    <compilation debug="true" targetFramework="4.0">
    </compilation>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />    
  </system.web>
  <system.serviceModel>   
    <bindings>      
      <basicHttpBinding>
        <binding>
          <security mode="None">            
          </security>
        </binding>                  
    <services>
      <service name="TConvertAS.Services.TempConverter">
        <endpoint address="" binding="basicHttpBinding" name="Service1" contract="TConvertAS.Contracts.ITempConverter" />                        
      </service>      
    </services>    
    <behaviors>      
      <serviceBehaviors>        
        <behavior>
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>        
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />        
  </system.serviceModel>  
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>            
  </system.webServer>  
</configuration>

Once you have the above just make sure about the app pool under which your application needs to be configured to run under.

Now just right click on the .svc file under the virtual directory and click browse to see the WCF service page.

(OR)

Instead of creating a new folder under c:\intepub\wwwroot you can directly map the virtual directory to your WCF service class library project and add the svc and web.config files to your WCF service class library project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top