Am I able to set “Default Web Site”'s properties through a child website's web.config file? (IIS6)

StackOverflow https://stackoverflow.com/questions/9336978

Question

I am experiencing the following issue under IIS6. I understand the issue completely, I am just looking for the best solution.

I have the following:

  • Default Web Site
    • apiservices
    • ourwebsite

The website 'apiservices' is running under .NET Framework v2.0 still. The website 'ourwebsite' is running under .NET Framework v4.0 using MVC3.

A sweet new feature introduced in .NET 4.0, Extensionless URL handling, is causing us some issues because of our mixed .NET framework versions.

If I go to:

  • 'ourwebsite' -> right click -> properties -> virtual directory tab -> configuration. I see that there exists a wildcard application mapping to .NET Framework v4.0 aspnet_isapi.dll. This is correct, but not sufficient due to our setup.
  • 'apiservices' -> right click -> properties -> virtual directory tab -> configuration. I see that there exists a wildcard application mapping to .NET Framework v2.0 aspnet_isapi.dll This is correct for our setup AND must not be set to 4.0 or it will break.

Now, here is the error introduced due to microsoft's changes: Because the ASP.NET v4.0 Application does not have its wildcard mapping defined at the root level, Default Web Site, PageMethods inside of our application get improperly routed and 404.

The crazy part? If I go to:

  • 'Default Web Site' -> right click -> properties -> 'Home Directory' tab -> configuration. And then, from here, add .NET Framework v4.0 to my Wildcard application maps.
  • I click OK. I am prompted to indicate which children websites I wish to apply these changes to because they both define their own wildcard application mappings. I indicate here that I only wish to apply this wildcard mapping to 'ourwebsite' and not 'apiservices'

Applying this change resolves our issue.

Now, I am wondering, how do I go about setting this? Is this the job of the web.config file -- can it control upper-level settings like this? Or is it the job of a custom action of our installer?

EDIT: It looks like I need to do this using WIX. Currently, I have the code below to set the wildcard map at the child level. I am exploring ways of setting it at the root level without overwriting 'apiservices' wildcard mapping:

<iis:WebVirtualDir Id="CSWebVirtualDir" Alias="[TARGETCSWEBVDIR]" Directory="CABLESOLVEWEBDIR" WebSite="DefaultWebSite">
    <iis:WebApplication Id="CSWebApplication" Name="[TARGETCSWEBVDIR]" AllowSessions="yes" ParentPaths="yes" ScriptTimeout="900" SessionTimeout="60" WebAppPool="CSWebAppPool" ClientDebugging="no" ServerDebugging="no" Isolation="medium">
        <iis:WebApplicationExtension Executable="[FRAMEWORKROOT]v4.0.30319\aspnet_isapi.dll" CheckPath="no" Script="yes" Verbs="GET,HEAD,POST" />
    </iis:WebApplication>
    <iis:MimeMap Id="MIMEXAP" Type="application/x-silverlight-app" Extension=".xap" />
    <iis:MimeMap Id="MIMEXAML" Type="application/xaml+xml" Extension=".xaml" />
</iis:WebVirtualDir>

<iis:WebVirtualDir Id="CSWebAPIVirtualDir" Alias="[TARGETCSWEBAPIVDIR]" Directory="CABLESOLVEWEBAPIDIR" DirProperties="CSWebAPIVirtualDirProperties" WebSite="DefaultWebSite">
    <iis:WebApplication Id="CSWebAPIApplication" Name="[TARGETCSWEBAPIVDIR]" ParentPaths="yes" AllowSessions="yes" ScriptTimeout="900" SessionTimeout="60" WebAppPool="CSWebAPIAppPool" ClientDebugging="no" ServerDebugging="no" Isolation="medium">
        <iis:WebApplicationExtension Executable="[FRAMEWORKROOT]v2.0.50727\aspnet_isapi.dll" CheckPath="no" Script="yes" Verbs="GET,HEAD,POST" />
    </iis:WebApplication>
</iis:WebVirtualDir>
Was it helpful?

Solution

Our solution was to add these steps to our install guide. I was unable to determine a way of simply modifying the Default Web Site.

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