Skip to content

Commit 7cafe21

Browse files
committed
Add necessary env vars, TODO property bag
1 parent 38df2bd commit 7cafe21

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

src/Servers/IIS/AspNetCoreModuleV2/InProcessRequestHandler/inprocessapplication.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,11 @@ IN_PROCESS_APPLICATION::ExecuteApplication()
235235
LOG_INFOF(L"Setting current directory to %s", this->QueryApplicationPhysicalPath().c_str());
236236
}
237237

238-
// TODO this doesn't work when running in VS and with the shared framework.
239-
// We could hack it so we check if the dll exists before and after setting the current directory
240-
// But the best solution would be to be able to set a specific assembly name rather than full path
241-
// See: https://github.com/dotnet/core-setup/issues/5556
242-
auto startupHookDll = Environment::GetCurrentDirectoryValue() + std::wstring(L"\\Microsoft.AspNetCore.Server.IIS.dll");
238+
// TODO add a way to disable this.
239+
auto startupHookDll = std::wstring(L"Microsoft.AspNetCore.Server.IIS");
243240

244241
SetEnvironmentVariable(L"DOTNET_STARTUP_HOOKS", startupHookDll.c_str());
242+
SetEnvironmentVariable(L"COMPlus_UseEntryPointFilter", L"1");
245243

246244
bool clrThreadExited;
247245
{

src/Servers/IIS/IIS/samples/NativeIISSample/Startup.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,15 @@ public void Configure(IApplicationBuilder app)
118118

119119
public static void Main(string[] args)
120120
{
121-
var host = new WebHostBuilder()
122-
.UseKestrel()
123-
.UseIIS()
124-
.UseIISIntegration()
125-
.UseStartup<Startup>()
126-
.Build();
127-
128-
host.Run();
121+
throw new Exception("woah");
122+
//var host = new WebHostBuilder()
123+
// .UseKestrel()
124+
// .UseIIS()
125+
// .UseIISIntegration()
126+
// .UseStartup<Startup>()
127+
// .Build();
128+
129+
//host.Run();
129130
}
130131
}
131132
}

src/Servers/IIS/IIS/src/StartupHook.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ internal class StartupHook
2727
public static void Initialize()
2828
{
2929
// TODO make this unhandled exception
30-
AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) =>
30+
AppDomain.CurrentDomain.UnhandledException += (sender, eventArgs) =>
3131
{
32-
var exception = eventArgs.Exception;
32+
var exception = (Exception)eventArgs.ExceptionObject;
3333

3434
// Get the content root from IIS.
3535
var iisConfigData = NativeMethods.HttpGetApplicationProperties();

0 commit comments

Comments
 (0)