@@ -114,9 +114,11 @@ internal void EnsureInitialized(WebHostSettings settings)
114
114
if ( ! WebScriptHostManager . InStandbyMode )
115
115
{
116
116
// standby mode can only change from true to false
117
- // When standby mode changes, we reset all instances
117
+ // when standby mode changes, we reset all instances
118
118
if ( _activeHostManager == null )
119
119
{
120
+ _settingsManager . Reset ( ) ;
121
+
120
122
_activeScriptHostConfig = CreateScriptHostConfiguration ( settings ) ;
121
123
_activeHostManager = new WebScriptHostManager ( _activeScriptHostConfig , _secretManagerFactory , _eventManager , _settingsManager , settings ) ;
122
124
_activeReceiverManager = new WebHookReceiverManager ( _activeHostManager . SecretManager ) ;
@@ -139,15 +141,15 @@ internal void EnsureInitialized(WebHostSettings settings)
139
141
_standbyScriptHostConfig = null ;
140
142
_standbyHostManager = null ;
141
143
_standbyReceiverManager = null ;
142
- _settingsManager . Reset ( ) ;
143
144
}
144
145
}
145
146
else
146
147
{
147
148
if ( _standbyHostManager == null )
148
149
{
149
- _standbyScriptHostConfig = CreateScriptHostConfiguration ( settings , true ) ;
150
- _standbyHostManager = new WebScriptHostManager ( _standbyScriptHostConfig , _secretManagerFactory , _eventManager , _settingsManager , settings ) ;
150
+ var standbySetings = CreateStandbySettings ( settings ) ;
151
+ _standbyScriptHostConfig = CreateScriptHostConfiguration ( standbySetings , true ) ;
152
+ _standbyHostManager = new WebScriptHostManager ( _standbyScriptHostConfig , _secretManagerFactory , _eventManager , _settingsManager , standbySetings ) ;
151
153
_standbyReceiverManager = new WebHookReceiverManager ( _standbyHostManager . SecretManager ) ;
152
154
153
155
InitializeFileSystem ( ) ;
@@ -156,6 +158,26 @@ internal void EnsureInitialized(WebHostSettings settings)
156
158
}
157
159
}
158
160
161
+ internal static WebHostSettings CreateStandbySettings ( WebHostSettings settings )
162
+ {
163
+ // we need to create a new copy of the settings to avoid modifying
164
+ // the global settings
165
+ // important that we use paths that are different than the configured paths
166
+ // to ensure that placeholder files are isolated
167
+ string tempRoot = Path . GetTempPath ( ) ;
168
+ var standbySettings = new WebHostSettings
169
+ {
170
+ LogPath = Path . Combine ( tempRoot , @"Functions\Standby\Logs" ) ,
171
+ ScriptPath = Path . Combine ( tempRoot , @"Functions\Standby\WWWRoot" ) ,
172
+ SecretsPath = Path . Combine ( tempRoot , @"Functions\Standby\Secrets" ) ,
173
+ LoggerFactoryBuilder = settings . LoggerFactoryBuilder ,
174
+ TraceWriter = settings . TraceWriter ,
175
+ IsSelfHost = settings . IsSelfHost
176
+ } ;
177
+
178
+ return standbySettings ;
179
+ }
180
+
159
181
internal static ScriptHostConfiguration CreateScriptHostConfiguration ( WebHostSettings settings , bool inStandbyMode = false )
160
182
{
161
183
var scriptHostConfig = new ScriptHostConfiguration
@@ -170,7 +192,6 @@ internal static ScriptHostConfiguration CreateScriptHostConfiguration(WebHostSet
170
192
171
193
if ( inStandbyMode )
172
194
{
173
- scriptHostConfig . RootScriptPath = Path . Combine ( Path . GetTempPath ( ) , "Functions" , "Standby" ) ;
174
195
scriptHostConfig . FileLoggingMode = FileLoggingMode . DebugOnly ;
175
196
scriptHostConfig . HostConfig . StorageConnectionString = null ;
176
197
scriptHostConfig . HostConfig . DashboardConnectionString = null ;
0 commit comments