Moving WCF Service to IIS

I moved my WCF service created last week from in-proc and custom standalone server to IIS.Step 1: VS2008, File, New WebSite, WCF Service. Add the previous MyService project into reference list.

Step 2: New file: MyGreetingService.svc

<%@ ServiceHost Language=”C#” Debug=”true” Service=”MyService.MyGreetingService” %>

Step 3: Web.config:

<service behaviorConfiguration=”MyGreetingServiceBehavior” name=”MyService.MyGreetingService”>
<endpoint address=”” binding=”wsHttpBinding” contract=”MyService.IMyGreetingService”>
<dns value=”localhost”/>
<endpoint address=”mex” binding=”mexHttpBinding” contract=”IMetadataExchange”/>
<behavior name=”MyGreetingServiceBehavior”>
<serviceMetadata httpGetEnabled=”true”/>
<serviceDebug includeExceptionDetailInFaults=”false”/>

Step 4: Add mapping in IIS Virtual Directory config: map .svc to aspnet. I got (405) Method Not Allowed at this point. Checked the post on MS forum, running the CleanIISScriptMaps.exe didn’t fix my problem, but manually mapping .svc extension to aspnet_isapi.dll resolved this problem.

Step 5: Test this WCF Service in browser: http://localhost/MyWCFServiceOnWeb/MyGreetingService.svc

Step 6: Client side config:

<endpoint name =”MyIISEndPoint”
address =”http://localhost/MyWCFServiceOnWeb/MyGreetingService.svc&#8221;
binding =”wsHttpBinding”
contract =”MyService.IMyGreetingService”

Step 7: Client side service calling code.

private void btnWCFIISOK_Click(object sender, EventArgs e)
WCFService1Client proxy = new WCFService1Client(“MyIISEndPoint”);
lblMessages.Text = proxy.GetGreetingMessagesFor(txtUserName.Text);


Juval Lowy said IIS Hosting WCF process is lauched automatically upon the first client request. But how can I tell? I need something like an IIS management console to monitor all the server side services.

Launch Microsoft service configuration editor – svcConfigEditor.exe in SDK folder, open the IIS WCF service.


Set trace in Diagnostics item.


Save config. Re-launch the client app. Check the new generated svclog files.

There is another tool called Microsoft Service Trace Viewer – SvcTraceViewer.exe from SDK, which is dedicate to open this kind of log file. The interface is graphic, but I think jagmanager is way better.

CSLA Wcf Host in trace viewer.


One thought on “Moving WCF Service to IIS

  1. Pingback: Log / Trace WCF Service « maonet technotes

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s