You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/FAQ.md
+31-17
Original file line number
Diff line number
Diff line change
@@ -149,22 +149,36 @@ some of the most frequent along with answers that are hopefully helpful.
149
149
150
150
<aname="vstyperes"></a>
151
151
<details>
152
-
<summary><b>Why do I get an error in Visual Studio when I switch my web app to use IIS instead of IISExpress?</b></summary>
152
+
<summary><b>Why do I get an error from Visual Studio when using my config builder?<br/>Or why does using IIS instead of IISExpress produce an error in Visual Studio?</b></summary>
153
153
154
-
> Many reasons. The gist of the situation is this... When you switch your web application to run in IIS
155
-
> instead of IISExpress, Visual Studio tries to read your config file to parse connection strings. I
156
-
> believe it's looking for 'LocalDB', but that's not really important. Your web app's config file is
157
-
> obviously not part of the process configuration for devenv.exe, so VS opens it via
158
-
> `ConfigurationManager.OpenConfiguration()` or something similar. Prior to V3, this was likely to
159
-
> result in failures in many of these key/value config builders if they were applied to the
160
-
> `<connectionStrings>` section.
161
-
>
162
-
> In V3, we handle the `ConfigurationManager.OpenConfiguration()` scenario better, but we can still
163
-
> get tripped up by the insanely complicated way Visual Studio manages reference binding. As a result,
164
-
> there may be version mis-matches when trying to load some builders. The Azure builders seem particularly
165
-
> vulnerable to this. I haven't found a good way to deal with this.
166
-
>
167
-
> **However,** even though the error appears in a scary dialog box, it does not affect the behavior of
168
-
> your application. When running/debugging your app on local IIS, the config builders are still able to
169
-
> execute as expected.
154
+
> There are many factors at play here. For the IIS/IISExpress scenario in particular (and likely
155
+
> most other scenarios where VS pops up an error dialog complaining about a failure to execute
156
+
> a config builder) the gist of the situation is this... When you switch your web application
157
+
> to run in IIS instead of IISExpress, Visual Studio tries to read your config file to parse
158
+
> connection strings. Obviously your applications's config file is not loaded as the active
159
+
> configuration for the Visual Studio (devenv.exe) process. So Visual Studio has to open it via
160
+
> `ConfigurationManager.OpenConfiguration()` or something similar in order to read the settings
161
+
> it needs.
162
+
>
163
+
> Versions 1 and 2 of these builders assumed they were always working on the active process
164
+
> config, and would go directly to `ConfigurationManager` to look up things like appSettings,
165
+
> builder definitions, or section handler configuration. This was likely to result in failures
166
+
> when working on a config section that was created in an `OpenConfiguration()` scenario,
167
+
> because the appSettings (or builder definition, etc) that we need probably doesn't exist
168
+
> in the active processes configuration. Rather, they probably exist in the `Configuration`
169
+
> object that was created by the call to `OpenConfiguration()`.
170
+
>
171
+
> Version 3 fixes this error, so these config builders should be more resilient in "OpenConfig()"
172
+
> scenarios.
173
+
>
174
+
> However, Visual Studio still complicates things by using it's own custom assembly-resolving
175
+
> and binding algorithms. As a result, VS might not be able to find the assembly that contains
176
+
> the builder trying to run. Or more likely (as I've seen is the case with the 'Azure' config
177
+
> builders here), Visual Studio already has a version of a dependent library loaded, and when the
178
+
> config builder asks for a different version, a binding failure can arise. I haven't found a
179
+
> good way to deal with this.
180
+
>
181
+
> **However,** even though the error appears in a scary dialog box, it should not affect the
182
+
> behavior of your application. When running/debugging your app on local IIS, the config builders
183
+
> are still able to execute at runtime as expected.
0 commit comments