-
Notifications
You must be signed in to change notification settings - Fork 58
Head-check on moving web.config
back to wwwroot
#164
Comments
I second this. I too will be moving it back to be similar to RC1. |
Debugging solved by swapping |
@guardrex did you get a chance to test it on Azure Websites? |
@muratg No. I only ran an IIS Local test. It would be good to know if this will break in Azure Apps. |
Use |
It fails in VS Code debug ...
... but if you simply change the @Bartmax might be testing this config in Azure Apps soon. |
@guardrex - I actually think it could be possible to contain all the changes to |
Env Var ApproachI didn't fully implement it b/c I could see along the way that it was something I wasn't interested in using, but it was shaping up along the lines of the following. Please correct the pseudo-code for others. I actually stopped cold with what you see here ... "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-*" using Microsoft.Extensions.Configuration;
var config = new ConfigurationBuilder()
.AddEnvironmentVariables(prefix: "ASPNETCORE_")
.Build();
var contentRootPath = Environment.GetEnvironmentVariable("ASPNETCORE_CONTENTROOT") ??
Directory.GetCurrentDirectory();
var host = new WebHostBuilder()
.UseContentRoot(contentRootPath) ...;
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add
name="aspNetCore"
path="*"
verb="*"
modules="AspNetCoreModule"
resourceType="Unspecified" />
</handlers>
<aspNetCore
processPath="..\teststandalone.exe"
stdoutLogEnabled="true"
stdoutLogFile="..\logs\teststandalone">
<environmentVariables>
<environmentVariable name="ASPNETCORE_CONTENTROOT" value="../" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration> Nah ..... It's not called the "CRAPJOB" pattern ... it's the "NUTJOB" pattern. 😄 This approach seems to do a lot of engineering for something that should be a simple workaround. That's too much crap floating around in my startup pattern, and I had no other interest in env vars, so it ends up bringing that into the app just for this one purpose. Another option ...
|
This issue is probably related, I perhaps should have created it here: dotnet/aspnetcore#1645 (comment) |
@JunTaoLuo @tracher @moozzyk
[Opened outside of the discussion on the announcement so that I can link/find it easier.]
Coming off of Publish for IIS changes to web.config location (Announcements/#173) and concern over accidental renaming or moving of
web.config
that would leak sensitive files, may I get a head-check for those wishing to putweb.config
back intowwwroot
?Use.UseContentRoot("../")
onWebHostBuilder
.UseContentRoot(Directory.GetParent(Directory.GetCurrentDirectory()).FullName)
processPath="..\my_app.exe"
(self-contained) orarguments="..\my_app.dll"
(portable)stdoutLogFile="..\logs\stdout"
(presuminglogs
is in the content root)web.config
towwwroot
wwwroot
Seems ok in testing. Is that correct or would that break something?
The text was updated successfully, but these errors were encountered: