wixtoolset / issues

WiX Toolset Issues Tracker
http://wixtoolset.org/
129 stars 24 forks source link

Can't set IIS WebAppPool ManagedRuntimeVersion to "No Managed Code" #5226

Open aroder opened 8 years ago

aroder commented 8 years ago

Leaving this attribute off causes the app pool to use the IIS default (which is not "No Managed Code").

Including the attribute but leaving its value blank results in a compile error, stating blank is not a valid value.

Using any other string value for this attribute results in an extra item in the IIS Manager drop down list.

Using "No Managed Code" as the attribute value also results in an extra item in the IIS Manager drop down list two items show "No Managed Code" in this case--the original one and the extra one.

How can you configure an IIS web app pool to be configured as "No Managed Code"?

cutylongshen commented 8 years ago

Hi aroder, i meet the same iisue, have you fixed yet? any suggestions i'd appreciate.

aroder commented 8 years ago

@cutylongshen even though the ASP.NET Core docs say to set it to No Managed Code (http://docs.asp.net/en/latest/publishing/iis.html), I just left it as the default (v4.0 on my machine). ASP.NET Core runs without any issues. Try it and let me know if that happens for you as well.

tompavaa commented 8 years ago

It would be nice if this feature was added. I am running into the same issue so we have to write our own custom action for now.

Core will for sure run without issues but the startup performance will be improved since the CLR does not have to be loaded into the worker process during startup.

robmen commented 8 years ago

Why not add the code to WiX instead of writing your own custom action?

dazinator commented 8 years ago

+1 I am also writing an installer for an asp core app, and have just hit this issue. Happy to attempt to contribute a PR if someone can point me to the code for the wix iis stuff..

dazinator commented 8 years ago

Ok so I am a new.. I have read: http://wixtoolset.org/development/ I have forked, signed the contrib agreement, and joined the mailing lists. After cloning, I tried to build the solution and found I had to run a "one time" proj file. i did that, but I still can't build the solution due to hundreds of errors where projects fail to build.

Is there some steps somewhere, of what has to be done to build the Wix solution from a fresh clone to a new environment?

Aside from not being able to build the solution, I proceeded to investigate where I would actually need to change the code.. All I came accross when hunting around, was the code that parses the AppPool from the wix XML here: https://github.com/dazinator/wix4/blob/develop/src/ext/IIsExtension/wixext/IIsCompiler.cs#L951

But i can't see where the calls are to IIS that actually create the app pool based on what was parsed. Can anyone give me some pointers on that bit?

Happy to continue with this, but I will need some guidance to get going..

barnson commented 8 years ago

The IIS custom action code lives under src\ext\ca\serverca.

jmcooper8654 commented 7 years ago

We're running into this issue with a hybrid product that uses ASP.NET Core. Looking to get approval to take this one.

jmcooper8654 commented 7 years ago

Testing and debugging a fix this morning for Wix3. Once I have that working, I'll migrate over for Wix4 and create a pull request.

jmcooper8654 commented 7 years ago

Working on getting my pull request up. I've developed for WiX 3.x because we needed it in production for one of our products. So, I will create a wix3 pull request with DO NOT MERGE mostly to: 1) document what I have done; and 2) provide someone similarly situated with an option while waiting for WiX 4.x. I will of course have a pull request for wix4 too.

Eternal21 commented 7 years ago

Should probably be merged into WiX 3.x as well, since that's what pretty much everyone is using.

Eternal21 commented 7 years ago

I ended up working around this bug, using a custom action that invokes a powershell script. Steps:

  1. Remove ManagedRuntimeVersionattribute from iis:WebSite element. If you set it to "", WiX will throw an error, and if you set it to "No Managed Code", then the install will work, but you'll end up with two "No Managed Code" options in AppPool dropdown box, and it won't work (the pool won't start).

  2. Create a setAppPoolToNoManagedCode.ps1 file with the following contents:

    Import-Module WebAdministration;
    Set-ItemProperty IIS:\AppPools\my_app_service_pool managedRuntimeVersion "";
  3. Install the file on the target system as part of your installer:

    <Component Directory="MyAppProgramFilesFolder">
        <File Id="setAppPoolToNoManagedCodePowershellFile" Source="set_app_pool_to_no_managed_code.ps1" />
    </Component>
  4. Create the following custom action inside your Product element:

    <CustomAction Id="PowershellCustomAction"
      Property="PowershellCustomActionProperty"
      Value="&quot;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe&quot; -ExecutionPolicy RemoteSigned -NoLogo -NonInteractive -InputFormat None -NoProfile -File &quot;[#setAppPoolToNoManagedCodePowershellFile]&quot;"
      Execute="immediate" />
    
    <CustomAction Id="PowershellCustomActionProperty"
      BinaryKey="WixCA"
      DllEntry="CAQuietExec64"
      Execute="deferred"
      Return="check"
      Impersonate="no" />
    
    <InstallExecuteSequence>
      <Custom Action="PowershellCustomAction" After="CostFinalize">NOT Installed</Custom>
      <Custom Action="PowershellCustomActionProperty" After="InstallExecute">NOT Installed</Custom>
simps7b2 commented 4 years ago

This works in .net Core 3.1:

      var app_pool = iis.ApplicationPools.Add("myAppPool");
      app_pool.ManagedRuntimeVersion = "";
      iis.CommitChanges();
mrakoczy commented 4 years ago

@simps7b2 i need a solution for <iis:WebAppPool/> Where can I use your code ?

simps7b2 commented 4 years ago

@mrakoczy - that code should work from within any .NET app. But I was testing it within .NET Core 3.1.

majkinetor commented 4 years ago

@mrakoczy, @simps7b2 Here is another version which is self contained:

$appPool = New-WebAppPool myAppPool
$appPool.ManagedRuntimeVersion = ''
$appPool | Set-Item
ccorral1-tenco commented 2 years ago

@mrakoczy, @simps7b2 Here is another version which is self contained:

$appPool = New-WebAppPool myAppPool
$appPool.ManagedRuntimeVersion = ''
$appPool | Set-Item

Can you explain where or how do you use this

majkinetor commented 2 years ago

@ccorral1-tenco I use it within PowerShell script for any IIS service I need to maintain.