<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Meatball&#039;s Guide to .NET &#187; IIS</title>
	<atom:link href="http://rogerpence.com/blog/index.php/archives/category/iis/feed" rel="self" type="application/rss+xml" />
	<link>http://rogerpence.com/blog</link>
	<description>A dogma-free guide to making real-world sense of .NET</description>
	<lastBuildDate>Wed, 23 Jun 2010 16:15:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Deploying a WCF service to IIS 6.0</title>
		<link>http://rogerpence.com/blog/index.php/archives/280</link>
		<comments>http://rogerpence.com/blog/index.php/archives/280#comments</comments>
		<pubDate>Thu, 08 Oct 2009 22:12:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[IIS]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://rogerpence.com/blog/?p=280</guid>
		<description><![CDATA[I needed to deploy a WCF Web service to a Windows 2003 server today. I was happy to realize that .NET 3.5 and .NET 3.5 SP1 were both installed, so I thought I was home free. Hardly. Here are the steps I needed to take to get the WCF 3.5 service running on the Windows [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to deploy a WCF Web service to a Windows 2003 server today. I was happy to realize that .NET 3.5 and .NET 3.5 SP1 were both installed, so I thought I was home free. Hardly. Here are the steps I needed to take to get the WCF 3.5 service running on the Windows 2003 server.</p>
<p><strong>Making IIS recognize the .SVC extension</strong></p>
<p>The first problem I had was that I got a 404 error when I tried to load the .SVC file in a browser. I knew I had the file name specified correctly and previous experience with JSON and IIS lead me to believe that IIS didn’t know about the .SVC file type. A little checking made me quickly realize that the .SVC file wasn’t mapped to the ASPNET_ISAPI.DLL in Windows 2003 Server’s IIS 6.0. </p>
<p>Before I did that manually, I read <a href="http://msdn.microsoft.com/en-us/library/ms752252.aspx">this MSDN article</a> and learned about the ServiceModelReg.exe. This exe registers script maps in IIS. I ran it on the server and it finished very quickly. The MSDN article recommends checking the SVC ISAPI mapping after having run this program, but the mapping was now in place for me. If it’s not for you, there are instructions at the end of the article that show how to map the .SVC extension to the ASPNET_ISAPI.DLL. (For what it’s worth, I did need these mapping instructions when attempting to host the service on my Windows 7 development box.) </p>
<p><strong>Preventing anonymous access to the service</strong></p>
<p>I thought I was home free. Alas, another error. When I attempted to load the .SVC file with the browser again, the file was now found but the error returned was&#160; <em>&#8216;Anonymous&#8217; Authentication but it is not enabled for the IIS application that hosts this service.&quot;</em> Hmm. I knew that I had anonymous access configured for the virtual directory—something seemed very screwy. A little googling lead me to <a href="http://blogs.msdn.com/drnick/archive/2007/03/23/preventing-anonymous-access.aspx">this article on Nicholas Allen’s Indigo Blog.</a> He clearly explained exactly the scenario I was experiencing.&#160; </p>
<p>To fix the problem, I disabled anonymous access on the virtual directory and then added the following &lt;security&gt; node to Web service’s binding configuration. </p>
<div class="sourceCodeHeading">Figure 1. Nicholas Allen&#8217;s fix to disable anonymous access</div>
<div id="Id0510167011SourceCode" class="sourceCode">
<pre class="even"><span class="ln">  1</span><span class="code">&lt;basicHttpBinding&gt;</span></pre>
<pre class="odd"><span class="ln">  2</span><span class="code">    &lt;binding name=&quot;allowBigData&quot; maxReceivedMessageSize=&quot;2000000&quot;&gt;                     </span></pre>
<pre class="even"><span class="ln">  3</span><span class="code">        &lt;readerQuotas maxArrayLength=&quot;2000000&quot; maxBytesPerRead=&quot;2000000&quot;/&gt;</span></pre>
<pre class="odd"><span class="ln">  4</span><span class="code">        &lt;security mode=&quot;TransportCredentialOnly&quot;&gt;</span></pre>
<pre class="even"><span class="ln">  5</span><span class="code">            &lt;transport clientCredentialType=&quot;Windows&quot; /&gt;    </span></pre>
<pre class="odd"><span class="ln">  6</span><span class="code">        &lt;/security&gt;</span></pre>
<pre class="even"><span class="ln">  7</span><span class="code">    &lt;/binding&gt;</span></pre>
<pre class="odd"><span class="ln">  8</span><span class="code">&lt;/basicHttpBinding&gt;</span></pre>
</div>
<div class="sourceCodeFooter"><a id="Id0510167011SourceCodeToClipboard" class="copyLink" href="javascript:toggleLineNumbers( 'Id0510167011SourceCode' );">Show copy-friendly code</a></div>
<p>Be sure to read Nicholas’s article closely—gotchas lurk if you’re using WSHttpBinding. </p>
<p>Thanks to Nicholas and MSDN, my service works now! </p>
<p>rp</p>
]]></content:encoded>
			<wfw:commentRss>http://rogerpence.com/blog/index.php/archives/280/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
