Skip to content

Commit 1ea1c9f

Browse files
committed
Avoid loading a number of assemblies on start
Also, move <system.web> into <location> section to avoid affecting child virtual apps
1 parent f4514d3 commit 1ea1c9f

File tree

2 files changed

+31
-30
lines changed

2 files changed

+31
-30
lines changed

src/WebJobs.Script.WebHost/Web.Release.config

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,11 @@
66
<appSettings>
77
<add key="Microsoft.Azure.NotificationHubs.ConnectionString" xdt:Locator="Match(key)" xdt:Transform="Remove" />
88
</appSettings>
9-
<!--
10-
In the example below, the "SetAttributes" transform will change the value of
11-
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
12-
finds an attribute "name" that has a value of "MyDB".
13-
14-
<connectionStrings>
15-
<add name="MyDB"
16-
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
17-
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
18-
</connectionStrings>
19-
-->
20-
<system.web>
21-
<compilation xdt:Transform="RemoveAttributes(debug)" />
22-
<hostingEnvironment shadowCopyBinAssemblies="false" xdt:Transform="Insert" />
239

24-
<!--
25-
In the example below, the "Replace" transform will replace the entire
26-
<customErrors> section of your web.config file.
27-
Note that because there is only one customErrors section under the
28-
<system.web> node, there is no need to use the "xdt:Locator" attribute.
29-
30-
<customErrors defaultRedirect="GenericError.htm"
31-
mode="RemoteOnly" xdt:Transform="Replace">
32-
<error statusCode="500" redirect="InternalError.htm"/>
33-
</customErrors>
34-
-->
35-
</system.web>
10+
<location path="." inheritInChildApplications="false">
11+
<system.web>
12+
<compilation xdt:Transform="RemoveAttributes(debug)" />
13+
<hostingEnvironment shadowCopyBinAssemblies="false" xdt:Transform="Insert" />
14+
</system.web>
15+
</location>
3616
</configuration>

src/WebJobs.Script.WebHost/Web.config

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,31 @@
1313
<httpRuntime targetFramework="4.5" />
1414
</system.Web>
1515
-->
16-
<system.web>
17-
<compilation debug="true" targetFramework="4.6" />
18-
<httpRuntime targetFramework="4.5" maxRequestLength="16384" />
19-
</system.web>
16+
<location path="." inheritInChildApplications="false">
17+
<system.web>
18+
<compilation debug="true" targetFramework="4.6">
19+
<assemblies>
20+
<!-- Don't load a few assemblies inherited from root config that we have no need for -->
21+
<remove assembly="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
22+
<remove assembly="System.WorkflowServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
23+
<remove assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
24+
<remove assembly="System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
25+
<remove assembly="System.Web.DynamicData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
26+
<remove assembly="System.Web.WebPages.Deployment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
27+
28+
<!-- Don't load all the bin assemblies, except for the only one we need -->
29+
<remove assembly="*" />
30+
<add assembly="Microsoft.Azure.WebJobs.Script.WebHost" />
31+
</assemblies>
32+
</compilation>
33+
<pages>
34+
<namespaces>
35+
<clear />
36+
</namespaces>
37+
</pages>
38+
<httpRuntime targetFramework="4.5" maxRequestLength="16384" />
39+
</system.web>
40+
</location>
2041
<system.webServer>
2142
<handlers>
2243
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />

0 commit comments

Comments
 (0)