diff --git a/eng/PatchConfig.props b/eng/PatchConfig.props
index dd96236f28..319d85992f 100644
--- a/eng/PatchConfig.props
+++ b/eng/PatchConfig.props
@@ -51,6 +51,8 @@ Later on, this will be checked using this condition:
+ Microsoft.AspNetCore.AspNetCoreModule;
+ Microsoft.AspNetCore.AspNetCoreModuleV2;
diff --git a/src/Installers/Windows/AspNetCoreModule-Setup/.gitignore b/src/Installers/Windows/AspNetCoreModule-Setup/.gitignore
new file mode 100644
index 0000000000..06d8a1a814
--- /dev/null
+++ b/src/Installers/Windows/AspNetCoreModule-Setup/.gitignore
@@ -0,0 +1,3 @@
+Debug/
+Win32/
+x64/
diff --git a/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV1/ancm_iis_express.wxs b/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV1/ancm_iis_express.wxs
index 00a8af36cf..6c60fedb04 100644
--- a/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV1/ancm_iis_express.wxs
+++ b/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV1/ancm_iis_express.wxs
@@ -348,66 +348,26 @@
Value=""[IISEXPRESS_INSTALL_PATH]appcmd.exe" set config -section:system.webServer/httpCompression /+"dynamicTypes.[\[]mimeType='text/event-stream',enabled='FALSE'[\]]" /apphostconfig:"[IISEXPRESS_APPHOST_CONFIG_TMP]""/>
-
+
-
-
-
+ Value="[IISEXPRESS_APPHOST_CONFIG]"/>
+
+
+
+
-
-
-
-
+ Property="CA_REMOVE_CONFIGSECTION"
+ Value="[IISEXPRESS_APPHOST_CONFIG]"/>
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+ Value="[IISEXPRESS_APPHOST_CONFIG32]"/>
+
+
+
+
@@ -581,6 +499,8 @@
+
+
@@ -591,6 +511,8 @@
+
+
@@ -621,6 +543,8 @@
+
+
@@ -631,6 +555,8 @@
+
+
diff --git a/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV2/ancm_iis_expressv2.wxs b/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV2/ancm_iis_expressv2.wxs
index 12a2c887b8..5980137c83 100644
--- a/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV2/ancm_iis_expressv2.wxs
+++ b/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV2/ancm_iis_expressv2.wxs
@@ -377,66 +377,25 @@
Value=""[IISEXPRESS_INSTALL_PATH]appcmd.exe" set config -section:system.webServer/httpCompression /+"dynamicTypes.[\[]mimeType='text/event-stream',enabled='FALSE'[\]]" /apphostconfig:"[IISEXPRESS_APPHOST_CONFIG_TMP]""/>
-
-
-
-
+ Value="[IISEXPRESS_APPHOST_CONFIG]"/>
+
+
+
+
-
-
-
-
+ Property="CA_REMOVE_CONFIGSECTION"
+ Value="[IISEXPRESS_APPHOST_CONFIG]"/>
+
+
+
+
-
-
-
-
-
-
+ Property="CA_ADD_CONFIGSECTION32"
+ Value="[IISEXPRESS_APPHOST_CONFIG32]"/>
+
+
+
+
-
-
-
-
+ Value="[IISEXPRESS_APPHOST_CONFIG32]"/>
+
+
+
+
@@ -611,7 +527,9 @@
-
+
+
+
@@ -621,6 +539,8 @@
+
+
@@ -651,7 +571,9 @@
-
+
+
+
@@ -661,6 +583,8 @@
+
+
diff --git a/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.cpp b/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.cpp
index 48d826f720..7b43840c52 100644
--- a/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.cpp
+++ b/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.cpp
@@ -2,6 +2,8 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#include
+#include
+#include
DECLARE_DEBUG_PRINT_OBJECT( "proxyCA.dll" );
@@ -40,6 +42,137 @@ struct COMPRESSION_MIME_TYPE
COMPRESSION_MIME_TYPE gMimeTypes[] =
{ { L"text/event-stream", FALSE} };
+#define _HR_RET(hr) __pragma(warning(push)) \
+ __pragma(warning(disable:26498)) /*disable constexpr warning */ \
+ const HRESULT __hrRet = hr; \
+ __pragma(warning(pop))
+
+#define _GOTO_FINISHED() __pragma(warning(push)) \
+ __pragma(warning(disable:26438)) /*disable avoid goto warning*/ \
+ goto Finished \
+ __pragma(warning(pop))
+
+#define RETURN_IF_FAILED(hrr) do { _HR_RET(hrr); if (FAILED(__hrRet)) { hr = __hrRet; IISLogWrite(SETUP_LOG_SEVERITY_INFORMATION, L"Exiting hr=0x%x", hr); return hr; }} while (0, 0)
+
+// Modifies the configSections to include the aspNetCore section
+UINT
+WINAPI
+AddConfigSection(
+ IN MSIHANDLE handle
+)
+{
+ HRESULT hr;
+ CComPtr pXMLDoc;
+ VARIANT_BOOL variantResult;
+ IXMLDOMNode* webServerNode;
+ IXMLDOMNode* aspNetCoreNode;
+ IXMLDOMNode* tempNode;
+ IXMLDOMElement* element;
+ STRU customActionData;
+
+ CComBSTR selectLanguage = SysAllocString(L"SelectionLanguage");
+ CComBSTR xPath = SysAllocString(L"XPath");
+ CComBSTR webServerPath = SysAllocString(L"//configuration/configSections/sectionGroup[@name=\"system.webServer\"]");
+ CComBSTR aspNetCorePath = SysAllocString(L"//configuration/configSections/sectionGroup[@name=\"system.webServer\"]/section[@name=\"aspNetCore\"]");
+ CComBSTR section = SysAllocString(L"section");
+ CComBSTR name = SysAllocString(L"name");
+ CComBSTR aspNetCore = SysAllocString(L"aspNetCore");
+ CComBSTR overrideMode = SysAllocString(L"overrideModeDefault");
+ CComBSTR allow = SysAllocString(L"Allow");
+
+ RETURN_IF_FAILED(CoInitialize(NULL));
+
+ hr = MsiUtilGetProperty(handle, TEXT("CustomActionData"), &customActionData);
+
+ RETURN_IF_FAILED(hr = pXMLDoc.CoCreateInstance(__uuidof(DOMDocument60)));
+
+ RETURN_IF_FAILED(hr = pXMLDoc->put_async(false));
+
+ RETURN_IF_FAILED(hr = pXMLDoc->load(CComVariant(customActionData.QueryStr()), &variantResult));
+
+ if (variantResult == VARIANT_FALSE)
+ {
+ return ERROR_SUCCESS;
+ }
+
+ RETURN_IF_FAILED(hr = pXMLDoc->setProperty(selectLanguage, CComVariant(xPath)));
+
+ RETURN_IF_FAILED(hr = pXMLDoc->selectSingleNode(webServerPath, &webServerNode));
+
+ RETURN_IF_FAILED(hr = pXMLDoc->selectSingleNode(aspNetCorePath, &aspNetCoreNode));
+
+ if (aspNetCoreNode == NULL)
+ {
+ RETURN_IF_FAILED(hr = pXMLDoc->createElement(section, &element));
+
+ RETURN_IF_FAILED(hr = element->setAttribute(name, CComVariant(aspNetCore)));
+
+ RETURN_IF_FAILED(hr = element->setAttribute(overrideMode, CComVariant(allow)));
+
+ RETURN_IF_FAILED(hr = webServerNode->appendChild(element, &tempNode));
+
+ RETURN_IF_FAILED(hr = pXMLDoc->save(CComVariant(customActionData.QueryStr())));
+ }
+
+ return ERROR_SUCCESS;
+}
+
+// Modifies the configSections to remove the aspNetCore section
+UINT
+WINAPI
+RemoveConfigSection(
+ IN MSIHANDLE handle
+)
+{
+ HRESULT hr;
+ CComPtr pXMLDoc;
+ VARIANT_BOOL variantResult;
+ IXMLDOMNode* webServerNode;
+ IXMLDOMNode* aspNetCoreNode;
+ IXMLDOMNode* tempNode;
+ STRU customActionData;
+
+ CComBSTR selectLanguage = SysAllocString(L"SelectionLanguage");
+ CComBSTR xPath = SysAllocString(L"XPath");
+ CComBSTR webServerPath = SysAllocString(L"//configuration/configSections/sectionGroup[@name=\"system.webServer\"]");
+ CComBSTR aspNetCorePath = SysAllocString(L"//configuration/configSections/sectionGroup[@name=\"system.webServer\"]/section[@name=\"aspNetCore\"]");
+ CComBSTR section = SysAllocString(L"section");
+ CComBSTR name = SysAllocString(L"name");
+ CComBSTR aspNetCore = SysAllocString(L"aspNetCore");
+ CComBSTR overrideMode = SysAllocString(L"overrideModeDefault");
+ CComBSTR allow = SysAllocString(L"Allow");
+
+ RETURN_IF_FAILED(CoInitialize(NULL));
+
+ hr = MsiUtilGetProperty(handle, TEXT("CustomActionData"), &customActionData);
+
+ RETURN_IF_FAILED(hr = pXMLDoc.CoCreateInstance(__uuidof(DOMDocument60)));
+
+ RETURN_IF_FAILED(hr = pXMLDoc->put_async(false));
+
+ RETURN_IF_FAILED(hr = pXMLDoc->load(CComVariant(customActionData.QueryStr()), &variantResult));
+
+ if (variantResult == VARIANT_FALSE)
+ {
+ return ERROR_SUCCESS;
+ }
+
+ RETURN_IF_FAILED(hr = pXMLDoc->setProperty(selectLanguage, CComVariant(xPath)));
+
+ RETURN_IF_FAILED(hr = pXMLDoc->selectSingleNode(webServerPath, &webServerNode));
+
+ RETURN_IF_FAILED(hr = pXMLDoc->selectSingleNode(aspNetCorePath, &aspNetCoreNode));
+
+ if (aspNetCoreNode != NULL)
+ {
+ RETURN_IF_FAILED(webServerNode->removeChild(aspNetCoreNode, &tempNode));
+
+ RETURN_IF_FAILED(hr = pXMLDoc->save(CComVariant(customActionData.QueryStr())));
+ }
+
+ return ERROR_SUCCESS;
+}
+
UINT
WINAPI
RegisterANCMCompressionCA(
diff --git a/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.def b/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.def
index 3518cde35f..ed516a4392 100644
--- a/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.def
+++ b/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.def
@@ -18,6 +18,8 @@ EXPORTS
ExecuteCleanUpWindowsHotfixCA
ScheduleRebootIfRequiredCA
+ AddConfigSection
+ RemoveConfigSection
RegisterANCMCompressionCA
CheckForServicesRunningCA
diff --git a/src/Installers/Windows/UpgradeLog.htm b/src/Installers/Windows/UpgradeLog.htm
new file mode 100644
index 0000000000..f327ebd6ec
Binary files /dev/null and b/src/Installers/Windows/UpgradeLog.htm differ