Re: web.config

From: Nick Malik [Microsoft] (nickmalik_at_hotmail.nospam.com)
Date: 02/19/05


Date: Sat, 19 Feb 2005 15:28:06 -0800

Hello Dan,

You definitely provided more information in that response. You also appear
to be a bit unhappy with Pete's response. He's only trying to help.

First off, the App Settings section appears under the configuration tags,
not within the system.web child:

<configuration>
   <system.web>
      ...
   </system.web>
   <appSettings>
       <add key="somekey" value="somevalue" />
   </appSettings>
</configuration>

Next, XML is case sensitive. It is not an <appsettings> section. it is an
<appSettings> section.

This is probably your problem.

For further info, this article is often useful:
http://samples.gotdotnet.com/quickstart/aspplus/doc/configretrieve.aspx

Also, the reason that Pete assumed that you are accessing a file is because
the CONTENT of the config app setting that you posted was a filename. He
was hoping to help you out of the next issue you may face: the fact that
ASP.NET applications do not normally have access to file system resources.

I hope this helps,

-- 
--- Nick Malik [Microsoft]
    MCSD, CFPS, Certified Scrummaster
    http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not 
representative of my employer.
   I do not answer questions on behalf of my employer.  I'm just a 
programmer helping programmers.
--
"Dan" <dan@dsully.com> wrote in message 
news:%23%232D%23mpFFHA.4052@TK2MSFTNGP14.phx.gbl...
>I don't have  NET 2 on the machine. I haven't used the "file" attribute in 
>the appsettings code so why would it think that I am referring to an 
>external file? The error comes up before the appsetting is accessed by vb 
>code. when I try to debug start---There are no compile errors.
>
> The KB article says that this error arises from a syntax error in the 
> web.config file. If I remove the three lines from the web.config file, the 
> problem goes away.
>
> It doesn't matter what I use as the key name or the value. If those lines 
> are present the rror is tripped.
>
> "Pete Wright" <peterjwright@gmail.com> wrote in message 
> news:e42PZymFFHA.1396@tk2msftngp13.phx.gbl...
>> This error doesn't actually have anything to do with web.config. There 
>> are number of reasons why this could happen, but the most common I see on 
>> my machines is that I have betas of Web Developer Express or Visual 
>> Studio.NEt 2005 on the machine. These cause the app to run as a .NET 2.0 
>> app. *IF* this is the case, download Denis Bauer's excellent ASP.NET 
>> version switcher from 
>> http://www.denisbauer.com/NETTools/ASPNETVersionSwitcher.aspx&e=9901. 
>> Then run it, point it at your application and switch it back into .NET 
>> 1.1 instead of .NET 2.
>>
>> If you aren't use a .NET 2.0 beta anywhere on the machine take a look at 
>> http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B306172. This 
>> describes common error messages and how to resolve them with .NET.
>>
>> Finally, the settings you posted for your web.config indicate that you 
>> want your application to access a local file at runtime. SInce this is a 
>> web application, make sure that the web application user has access 
>> rights to that file or you will find that you will next get a security 
>> violation error thrown when you do resolve the problem.
>>
>> Hope that helps,
>>
>>
>> -- 
>> Pete Wright
>> Author of ADO.NET Novice to Pro for Apress
>> www.petewright.org
>>
>>
>>
>>
>> "Dan" <dan@dsully.com> wrote in message 
>> news:OR7E4LiFFHA.2736@TK2MSFTNGP09.phx.gbl...
>>>I am trying to add a definition for ConnString to web.config as follows 
>>>(VB.NET STD 2003)
>>>
>>> <configuration>
>>> <system.web>
>>> .........
>>> <appsettings>
>>>    <add key="ConnString" value="C:\test\test.mdb" />
>>> </appsettings>
>>>
>>> </system.web>
>>> </configuration>
>>>
>>> When I try to run it, I get "Error while trying to run project: Unable 
>>> to start debugging on web server. Server side error occurred on sending 
>>> debug HTTP request."
>>>
>>> I have tried relocating the entry inside the <system.web> tags with the 
>>> same result.
>>>
>>> What am I doing wrong?  Thanks.
>>>
>>
>>
>
> 


Relevant Pages

  • RE: Share AppSettings configuration between a service Web and an asp.net web application
    ... the IIS root site and modify the AppSettings section in it, ... Here is a test function which open & modify web.config file in IIS site ... Microsoft MSDN Online Support Lead ... Share AppSettings configuration between a service Web and an ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Structure analogous to web.config in a windows application???
    ... choose 'Application Configuration'. ... AppSettingsReader appSettings = new AppSettingsReader; ... > the web.config in ASP.NET applications? ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: ConnectionString not initialized..?
    ... The appSettings key must be within ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Shared app.config
    ... Its located in the CONFIG directory of the runtime install path ... > This situation requres many exes to be sitting on a network share. ... > in the appSettings configuration section. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: appsetting in class doesnt work
    ... I think it may make you want to hurl at what MS has done with configuration ... an appsettings section. ... Dim cnfg As System.Configuration.Configuration ... the settings enter in the designer. ...
    (microsoft.public.dotnet.languages.vb)