locked
Custom App Pool not working RRS feed

  • Question

  • User-520980348 posted

    By default all sites of the the same framework will use the same app pool definition from the applicationhost.config. I have 2 ASP .Net 4.6.2 web apps that require an environment variable to be set for a 3rd party process they both use, but I can't just set them globally as they need to be different. Our current solution is that we set them up in IIS then attach to the process when debugging. There is many more weird steps we have to take and troubleshoot when things don't work that I've resolved by switching to IIS Express except for 1. I can't get Visual Studio to honor the app pool setting in the applicationhost.config file

    <applicationPools>
    	<add name="TenantAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
    	<add name="Clr4IntegratedAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
    	<add name="Clr4ClassicAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
    	<add name="Clr2IntegratedAppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
    	<add name="Clr2ClassicAppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
    	<add name="UnmanagedClassicAppPool" managedRuntimeVersion="" managedPipelineMode="Classic" autoStart="true" />
    	<applicationPoolDefaults managedRuntimeVersion="v4.0">
    		<processModel loadUserProfile="true" setProfileEnvironment="false" />
    	</applicationPoolDefaults>
    </applicationPools>
    <site name="Tenant" id="2">
        <application path="/" applicationPool="TenantAppPool">
            <virtualDirectory path="/" physicalPath="[full physical path]" />
        </application>
        <bindings>
            <binding protocol="http" bindingInformation="*:54399:localhost" />
        </bindings>
    </site>

    However when I start debugging I get a refused connection response and the command line column in task manager shows the following

    "C:\Program Files (x86)\IIS Express\iisexpress.exe"  /config:"[correct path to applicationhost.config]" /site:"Tenant" /apppool:"Clr4IntegratedAppPool"

    Is this a bug or am I missing a step to get Visual Studio to honor the applicationPool attribute in the applicationhost.config?

    Running Visual Studio Professional 2019 Version 16.7.5 latest update as of posting

    Thursday, October 8, 2020 3:50 PM

All replies

  • User-1330468790 posted

    Hi c0d3m0mk3y,

      

    It seems completely correct settings for adding application pool and binding that for sites.

    I did the same thing and tried to reproduce the problem. Successfully reproduced the problem in below steps:

    1. Open the project
    2. Open the applicationHost.config in VS (the one located in the .vs folder of the project) and add the application pool "TenantAppPool" as yours.
    3. Modify the "applicationPool" property for the target site.
    4. Save and run the project in IIS express
    5. The browser tells me that the localhost refuses to connect.

    Is this the same as your problem?

     

    I resolved the issue by closing the VS and reopen it. Then the project could be accessed.

    I think the reason why we got the refused connection is that the VS cannot get the modification correctly.

     

    Could you please try to reopen the VS to see if you could solve the problem? 

     

    Best regards,

    Sean

    Friday, October 9, 2020 4:39 AM