-
Notifications
You must be signed in to change notification settings - Fork 222
[HttpPlatformHandler]: Publish changes to web.config for IIS based hosting #2682
Description
We need to change the web.config that publish generates to be based on httpplatformhandler based hosting.
Here's what a typical web.config looks like today for Helios:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="bootstrapper-version" value="1.0.0-beta7" />
<add key="runtime-path" value="..\approot\runtimes" />
<add key="dnx-version" value="1.0.0-beta7" />
<add key="dnx-clr" value="clr" />
<add key="dnx-app-base" value="..\approot\src\meetup" />
</appSettings>
<system.web>
<httpRuntime targetFramework="4.6" />
</system.web>
</configuration>Here's what the new web.config (tentative) would look like:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="..\web.cmd"
arguments=""
stdoutLogEnabled="true"
stdoutLogFile="..\stdout.tlog">
</httpPlatform>
</system.webServer>
</configuration>The .cmd file also has to be updated to take variable into account:
Few notes:
- We're waiting on the httpplatformhandler to support relative paths. This will make the web.config alot more portable (and self contained).
- We need to know which command to put the relative path to in
web.config, this might be an option. - Notice we don't need any of the old variables since all of that knowledge is encapsulated in the
.cmdfile e.g.
@"%~dp0approot\runtimes\dnx-clr-win-x64.1.0.0-beta8-15594\bin\dnx.exe" --appbase "%~dp0approot\packages\WebApplication74\1.0.0\root" Microsoft.Dnx.ApplicationHost --configuration Debug web %*
- Dnx version selection (based on what was passed into publish --runtime switch)
- The appbase, configuration etc
We want to make this work with a global cache if it has a the version of the dnx installed. The .cmd file could be updated to detect the versions of runtime in DNX_HOME. This would look like:
SET DNX_FOLDER=dnx-clr-win-x64.1.0.0-beta8-15594
"HOME_DNX=%DNX_HOME%\runtimes\%DNX_FOLDER%\bin\dnx.exe"
"LOCAL_DNX="%~dp0approot\runtimes\%DNX_FOLDER%\bin\dnx.exe"
IF EXIST %HOME_DNX% (
"DNX_PATH=%HOME_DNX%"
) ELSE IF EXISTS %LOCAL_DNX% (
"DNX_PATH=%LOCAL_DNX%"
)
ELSE (
DNX_PATH=dnx
)
@%DNX_PATH% --appbase "%~dp0approot\packages\WebApplication74\1.0.0\root" Microsoft.Dnx.ApplicationHost --configuration Debug web %*
I didn't test the above but the gist is to test if the DNX_HOME/runtime exists over the local one. This only applies if the full version was specified. Otherwise we'll use the one on the path. We could consider always some variable that would be settable from the outside to control aspects of running.
Features of helios:
- Exclude the runtime and have the layout still be found via version
- Change the bitness without redeploying if both runtimes are "installed"