<?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>ByteCyclist.com &#187; IIS7</title>
	<atom:link href="http://www.bytecyclist.com/tag/iis7/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bytecyclist.com</link>
	<description>A site made of bytes by a cyclist.</description>
	<lastBuildDate>Fri, 14 Aug 2009 04:46:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Frustrating IIS7 Configuration 500 Error</title>
		<link>http://www.bytecyclist.com/2008/09/22/frustrating-iis7-configuration-500-error/</link>
		<comments>http://www.bytecyclist.com/2008/09/22/frustrating-iis7-configuration-500-error/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 18:13:05 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[IIS7]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://www.bytecyclist.com/?p=19</guid>
		<description><![CDATA[Recently I have been putting a lot of my evenings and weekends in to a re-architecting of a site I host and develop for some friends of mine Pert&#8217; Near Sandstone. The Entire site is built using ASP.Net and features &#8230; <a href="http://www.bytecyclist.com/2008/09/22/frustrating-iis7-configuration-500-error/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently I have been putting a lot of my evenings and weekends in to a re-architecting of a site I host and develop for some friends of mine <a title="Pert Near Sandstone" href="http://www.pertnearsandstone.com" target="_blank">Pert&#8217; Near Sandstone.</a> The Entire site is built using ASP.Net and features a standard (web forms) website front end (public facing) and an admin side also built using web forms.  I liked this at the time, but it soon became very difficult to debug, maintain and add features to.</p>
<p>The biggest factor in deciding the re-architect the site at the time was the lack of interoperability in the Admin side/application.  It worked as intended about 60% of the time (60% of the time it works every time).  The web forms admin side required a lot of code that was spread out over numerous code behind files, making it difficult to maintain.  Not to mention similar logic was being duplicated, violating the DRY principal (don&#8217;t repeat yourself).</p>
<p>Around the same time I had just finished my exploration of the new ASP.Net MVC (model-view-controller) model and had fallen in love with web development all over again.  I had been in the process of creating some sample applications with it.  I even started testing how it deployed on various web hosting platforms.  I discovered that the MVC pattern DID work on IIS6 and IIS7.  The URL&#8217;s on IIS6 required special mapping (either adding .aspx or .mvc to map to the aspnet framework), I didn&#8217;t like that so I found a host that offered IIS7.  The URL&#8217;s are now clean and to my liking.  MVC makes sense, it creates clean separation of UI, business logic and data models. and will be an architecture of choice on ASP.Net.</p>
<p>So to make my long story short and to the point.  I ended up re-architecting the Admin (once web forms side) of my site/project into a new MVC project in my solution.  I started bringing over functionality one peice at a time, while reworking the underlying business logic and data access logic into various providers and repositories.  I had everything working perfectly for a phase one deployment to the web host.  I had 2 projects to deploy, one public facing site (web forms) and one admin MVC site.  I set up the web host to use a virtual directory for the the MVC site, configured my connection strings as:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;connectionStrings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #808080; font-style: italic;">&lt;!-- PRD --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;add</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;PertNear.Data.Properties.Settings.PertNearSandstoneConnectionString&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">connectionString</span>=<span style="color: #ff0000;">&quot;server=secureserver.net;uid=user;pwd=pass;database=db&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">providerName</span>=<span style="color: #ff0000;">&quot;System.Data.SqlClient&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;add</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;PertNear.Membership&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">connectionString</span>=<span style="color: #ff0000;">&quot;server=secureserver.net;uid=user;pwd=pass;database=db&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">providerName</span>=<span style="color: #ff0000;">&quot;System.Data.SqlClient&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!--</span>
<span style="color: #808080; font-style: italic;">    &lt;!--  DEV</span>
<span style="color: #808080; font-style: italic;">    &lt;add name=&quot;PertNear.Data.Properties.Settings.PertNearSandstoneConnectionString&quot;</span>
<span style="color: #808080; font-style: italic;">connectionString=&quot;Data Source=localhost;Initial Catalog=DB;Integrated Security=True&quot;</span>
<span style="color: #808080; font-style: italic;">providerName=&quot;System.Data.SqlClient&quot; /&gt;</span>
<span style="color: #808080; font-style: italic;">    &lt;add name=&quot;PertNear.Membership&quot;</span>
<span style="color: #808080; font-style: italic;">connectionString=&quot;Data Source=localhost;Initial Catalog=DB;Integrated Security=True&quot;</span>
<span style="color: #808080; font-style: italic;">providerName=&quot;System.Data.SqlClient&quot; /&gt;</span>
<span style="color: #808080; font-style: italic;">    --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/connectionStrings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>I uploaded everything to the virtual directory and tried to access the new applications.  The public facing side (web forms) worked cause it had a separate config file, the admin side through the generic IIS7 internal server error with no messages.  I looked everywhere to find a solution.  Many sources said to add a wrapping element around the parent web.config so that it&#8217;s settings don&#8217;t conflict with the virtual directories (inheritance in IIS7 config files). I spent a week plus on this issue until I ran the config file through an XML validator.  As you can see I had a rouge comment tag in the config.  Had I known that IIS7 was first validating my config file I might have gotten an error along the lines of &#8220;invalid xml&#8221; instead of generic 500 error.</p>
<p>Reader be warned, be sure the validate the web.config file before uploading.  And check the config file before you make any drastic changes like I did (I moved the MVC project into the public facing site to now have just one project to deploy, thinking that might solve the issue).  One point worth mentioning, I had edited my published web.config outside of VS2008 in a text editor, hopefully VS would have caught that error for me had I known.</p>
<p>Good luck, happy coding and avoid the frustration I had.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bytecyclist.com/2008/09/22/frustrating-iis7-configuration-500-error/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
