web.config again

B

baerland

Hi all!

I have browsed through houndreds of threads with problems conserning
web.config, but not yet found a solution to this problem.

I have a test server running .NET 1.0, 1.1 and 2.0
I have a web application (virtual directory with application set), with
a web.config file.
The asp.net properties of this application is set to use .NET 1.0 in
IIS
web.config file:
<appSettings>
<add key="DBstring"
value="SERVER=x.x.x.x;DATABASE=db;UID=uid;PWD=pwd;application
name=somename;Max Pool Size=75000"/>
</appSettings>
<system.web>

in aspx file:
Imports System.Configuration

Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
DBString = ConfigurationSettings.AppSettings("DBstring")

This however returns null and produces this error:
The ConnectionString property has not been initialized

Any help would be greatly appreciated.
-Erlend
 
K

Karl Seguin

The appSettings belongs OUTSIDE of the system.web section...

<appSettings>
<add .../>
</appSettings>
<system.web>
...
</system.web>

Karl
 
B

baerland

Thanks for your reply!

But it is outside:
<appSettings>
<add key="DBstring"
value="SERVER=x.x.x.x;DATABASE=db;UID=uid;PWD=pwd;application
name=somename;Max Pool Size=75000"/>
</appSettings>
<system.web>
.....
</system.web>
 
K

Karl Seguin

lol...and here I thought I had the easy fix...must have been too early when
I saw that, was sure it was inside...

Have you tried setting it to work with 1.1 instead? Or on a server with only
1 version?

karl
 
B

baerland

Easy to get lost in them tags:)

I tried setting it to 1.1, and interestingly enough, I get an access
denied error trying to read the web.config file located in the parent
virtual directory.
"Access denied to 'c:\inetpub\wwwroot\myApp\web.config'. Failed to
start monitoring file changes. "

The web.config file I want it to use is:
'c:\inetpub\wwwroot\myApp\myRealApp\web.config'
I then copyed my web.config file to the folder in the errormsg, and set
(read/execute)permissions to iuser and aspnet, but I still got the same
error.

Then I tried recreating the application in iis, but without luck.
Yes, the application is also running on a live server without 2.0, and
it works perfectly!
I tried reregistering asp.net (regasp_iis from the 1.0 framework
folder) today, without any luck.

I suspect the 2.0 Framework installation caused this, strange
web.config behaviour.

I hope someone might share some ideas to what I'm doing wrong.
 
B

baerland

Amazing! I got it to work.
I set 1.1 on the virtual directory closest to the root, and 1.0 on the
virtual directory hosting my webapp

I wish I knew why though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top