Web.config in the virtual directory is not the main parent Web.config website

I have a website with a virtual directory, which also includes a website, and when I try to start a page from a virtual directory, I get an IIS 7.5 error that the name (from the connection string) is already in the collection. This was not a problem before I added the domain user as Identity in the application pool. Does anyone know why this is happening? I got the impression that the sub.config level application overrides the parent by default. And again, this once worked until I added user authentication.

Error on page "Parser error message: record" dbname "has already been added."

Where dbname is in both lines of the connection (i.e. in the parent and virtual directory). I cannot delete one of the connection strings because the virtual directory was created for test purposes only, but in production it works as its own website.

+5
source share
2 answers

Sub web.config does not override the parent regardless of the application. All web.configs will add up to the root of the main application. In order for the sub-application folder to use the existing connection string key, it must first be deleted or all connection strings must be cleared. If you want this to be a truly standalone application as a child, add it to your connection strings:

<connectionStrings>
    <clear />
    <your connection string>
<connectionStrings>

, :

<remove key="yourConnectionStringName" />
+7

@u84six,

. - - . iis (- ), , C:\Inetpub\wwwroot. .

, , , - ( , ... , 2010 2012 ). - connectionString. C:\Inetpub\wwwroot \, .

, .

0

All Articles