IIS Express Child Application Config Inheritence Inheritance

I am trying to get an MVC3 application with WCF service as a child application, working as expected in IIS Express. It works fine in IIS, but does something weird in IIS Express.

When I run the site in IIS, the configuration settings from child and parent applications are available in the child application. However, when I run the same code in IIS Express, only the parent settings are available.

I cannot find any documentation on this expected behavior. This does not rule it out, but I tend to suspect that I have a configuration problem.

The question is, how can I run these sites in IIS Express without losing the settings applied in the child application?

I am using windows 7 box with Visual Studio 2010, MVC3 and IIS Express 8.

Here is the site config in my applicationhost.config file.

<site name="ParentMvcApp" id="7">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="c:\users\<username>\documents\visual studio 2010\Projects\ChildAppTest\ParentMvcApp" />
    </application>
    <application path="/Services/ChildWcfApp" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="c:\users\<username>\documents\visual studio 2010\Projects\ChildAppTest\ChildWcfApp" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:33888:localhost" />
    </bindings>
</site>

      

Here is the content of the MVC config file.      

<configuration>
  <appSettings>
    <add key="webpages:Version" value="1.0.0.0"/>
    <add key="ClientValidationEnabled" value="true"/>
    <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
  </appSettings>

  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
    </compilation>

    <authentication mode="Forms">
      <forms loginUrl="~/Account/LogOn" timeout="2880" />
    </authentication>

    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages"/>
      </namespaces>
    </pages>
  </system.web>

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IService1" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:33888/Services/ChildWcfApp/Service1.svc" binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReference1.IService1"
        name="BasicHttpBinding_IService1" />
    </client>
  </system.serviceModel>
</configuration>

      

Here is the content of the WCF service configuration file.

<?xml version="1.0"?>
<configuration>
    <appSettings>
        <add key="Test"
             value="Wtf"/>
    </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>

      

+3


source to share


1 answer


I finally found the problem. My subqueries were 2 levels deep. Unfortunately, in this case, IIS Express does not act like full blown IIS. Even though they were configured as applications, IIS Express did not read their configuration files. I had to explicitly add a virtual directory configuration for the parent folder for which the allowSubDirConfig attribute is set to true.



<virtualDirectory path="/Services" allowSubDirConfig="true" />

      

+1


source







All Articles