Skip to content

Commit d61a4ca

Browse files
authored
some fix for handling configuration change and recycling (#539)
1 parent 9c4a784 commit d61a4ca

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

src/AspNetCore/Inc/globalmodule.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class ASPNET_CORE_GLOBAL_MODULE : public CGlobalModule
2828
);
2929

3030
GLOBAL_NOTIFICATION_STATUS
31-
OnGlobalConfigurationChange(
32-
_In_ IGlobalConfigurationChangeProvider * pProvider
31+
OnGlobalApplicationStop(
32+
_In_ IHttpApplicationStopProvider * pProvider
3333
);
3434

3535
private:

src/AspNetCore/Src/applicationmanager.cxx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,14 @@ APPLICATION_MANAGER::ShutDown()
235235

236236
// clean up the hash table so that the application will be informed on shutdown
237237
m_pApplicationInfoHash->Clear();
238+
238239
ReleaseSRWLockExclusive(&m_srwLock);
239240
}
240241

242+
// stop filewatcher monitoring thread
243+
if (m_pFileWatcher != NULL)
244+
{
245+
delete m_pFileWatcher;
246+
m_pFileWatcher = NULL;
247+
}
241248
}

src/AspNetCore/Src/dllmain.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,9 @@ HRESULT
201201
}
202202

203203
hr = pModuleInfo->SetGlobalNotifications(
204-
pGlobalModule,
205-
GL_CONFIGURATION_CHANGE | GL_STOP_LISTENING);
204+
pGlobalModule,
205+
GL_APPLICATION_STOP | // Configuration change trigers IIS application stop
206+
GL_STOP_LISTENING); // worker process stop or recycle
206207

207208
if (FAILED(hr))
208209
{

src/AspNetCore/Src/globalmodule.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ ASPNET_CORE_GLOBAL_MODULE::OnGlobalStopListening(
3434
// Recycled the corresponding core app if its configuration changed
3535
//
3636
GLOBAL_NOTIFICATION_STATUS
37-
ASPNET_CORE_GLOBAL_MODULE::OnGlobalConfigurationChange(
38-
_In_ IGlobalConfigurationChangeProvider * pProvider
37+
ASPNET_CORE_GLOBAL_MODULE::OnGlobalApplicationStop(
38+
_In_ IHttpApplicationStopProvider * pProvider
3939
)
4040
{
41-
UNREFERENCED_PARAMETER(pProvider);
42-
4341
// Retrieve the path that has changed.
44-
PCWSTR pwszChangePath = pProvider->GetChangePath();
42+
IHttpApplication* pApplication = pProvider->GetApplication();
43+
44+
PCWSTR pwszChangePath = pApplication->GetAppConfigPath();
4545

4646
// Test for an error.
4747
if (NULL != pwszChangePath &&

0 commit comments

Comments
 (0)