Questions tagged [web-config]
web.config is an XML file that stores the main settings and configuration files for an IIS server.
web-config
8,692
questions
499
votes
38
answers
527k
views
Login failed for user 'IIS APPPOOL\ASP.NET v4.0'
I have a web project (C# Asp.Net, EF 4, MS SQL 2008 and IIS 7) and I need to migrate it to IIS 7 locally (at the moment works fine with CASSINI).
Locally in IIS I have my Default Web Site with my ...
284
votes
4
answers
126k
views
How to change the value of attribute in appSettings section with Web.config transformation
Is it possible to transform the following Web.config appSettings file:
<appSettings>
<add key="developmentModeUserId" value="00297022" />
<add key="...
273
votes
13
answers
462k
views
Read connection string from web.config
How can I read a connection string from a web.config file into a public class contained within a class library?
I've tried:
WebConfigurationManager
ConfigurationManager
But these classes are not ...
261
votes
12
answers
205k
views
Specified argument was out of the range of valid values. Parameter name: site
I am getting this Kind of Error like::
Specified argument was out of the range of valid values.Parameter name: site
while Debugging any of my Project.
I have also tried after Reinstalling My ...
258
votes
10
answers
324k
views
How to force HTTPS using a web.config file
I have searched around Google and StackOverflow trying to find a solution to this, but they all seem to relate to ASP.NET etc.
I usually run Linux on my servers but for this one client I am using ...
241
votes
4
answers
120k
views
How can I add an ampersand for a value in a ASP.net/C# app config file value
I've got a C# program with values in a config file. What I want is to store ampersands for an url value like...
<appSettings>
<add key="myurl" value="http://www.myurl.com?&cid=&...
222
votes
33
answers
403k
views
Error to use a section registered as allowDefinition='MachineToApplication' beyond application level
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.
The top line in all of my aspx pages in my /portal/ directory has this error message, ...
215
votes
10
answers
182k
views
Using different Web.config in development and production environment
I need to use different database connection strings and SMTP server addresses in my ASP.NET application, depending on where it is run, in development or production environment.
The application reads ...
210
votes
1
answer
69k
views
ASP.NET web.config: configSource vs. file attributes
Within an web.config-file in an ASP.NET-application some sections of config, like appSettings and connectionStrings, supports the attributes file and configSource.
What is the difference between ...
209
votes
2
answers
76k
views
Difference between <system.web> and <system.webServer>?
Every time I have to add a handler or module for ASP.NET with IIS7, the instructions always tell me to incorporate it into two sections: system.web and system.webserver.
<system.web>
<...
193
votes
4
answers
91k
views
What is the difference between customErrors and httpErrors?
What is the difference between the customErrors and httpErrors sections of the web.config file in ASP.NET MVC applications?
What are the guidelines for using each section?
186
votes
8
answers
572k
views
How to increase request timeout in IIS?
How to increase request timeout in IIS 7.0? The same is done under application tab in ASP configuration settngs in IIS 6.0. I am not able to find the asp.net configuration section in IIS 7.0
185
votes
3
answers
351k
views
How to set web.config file to show full error message
I deployed my MVC-3 application on windows Azure. But now when I am requesting it through staging url it shows me (Sorry, an error occurred while processing your request.). Now I want to see the full ...
176
votes
6
answers
107k
views
Pros and cons of AppSettings vs applicationSettings (.NET app.config / Web.config)
When developing a .NET Windows Forms Application we have the choice between those App.config tags to store our configuration values. Which one is better?
<configuration>
<!-- Choice 1 --&...
173
votes
23
answers
291k
views
ASP.NET: HTTP Error 500.19 – Internal Server Error 0x8007000d
I am replicating web application deployment and found several issues related to HTTP Error 500.19. My machine is running Windows 7 while the working development is using Windows 8. We're developing ...
172
votes
10
answers
296k
views
How to configure the web.config to allow requests of any length
I am building a site in which i would like to create a file client side from the value of a textarea element.
I have the code in place to do this, but i am getting this error
HTTP Error 404.15 - ...
170
votes
7
answers
211k
views
Avoid web.config inheritance in child web application using inheritInChildApplications
I am trying to add
<location inheritInChildApplications="false">
to my parent web application's web.config but it doesn't seem to be working.
My parent's web.config has:
<configuration>...
167
votes
5
answers
97k
views
Use Visual Studio web.config transform for debugging
Possible Duplicate:
How can I use Web.debug.config in the built-in visual studio debugger server?
I want to use the Web.config transformation that works fine for publish also for debugging.
When I ...
166
votes
6
answers
72k
views
[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to... web.config issue
I am getting the following error:
[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast
to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A
originates from 'System....
164
votes
7
answers
176k
views
Forms authentication timeout vs sessionState timeout
I have code that i am looking through regarding session time outs of the website. In the web.config i came across this code.
<authentication mode="Forms">
<forms loginUrl="~/Auth/SignOn....
159
votes
24
answers
297k
views
Web Application Problems (web.config errors) HTTP 500.19 with IIS7.5 and ASP.NET v2
This is driving the whole team crazy. There must be some simple mis-configured part of IIS or our Web Server, but every time we try to run out ASP.NET Web Application on IIS 7.5 we get the following ...
151
votes
1
answer
188k
views
<modules runAllManagedModulesForAllRequests="true" /> Meaning
I wanted to know what is the meaning of
<modules runAllManagedModulesForAllRequests="true" />
I am using IIS 7.5 and I have a simple web application. Do I need to write this in my web.config ...
149
votes
3
answers
126k
views
How to configure static content cache per folder and extension in IIS7?
I would like to set up rules in IIS7 for static content caching in my ASP.NET website.
I have seen these articles, which details how to do it using the <clientCache /> element in web.config:
...
140
votes
2
answers
58k
views
Which gets priority, maxRequestLength or maxAllowedContentLength?
While changing the maximum allowed file size for upload I stumbled on those two settings.
In the sytem.web you have the http runtime node with maxRequestLength.
In the system.webServer you have the ...
131
votes
8
answers
235k
views
How to set the Default Page in ASP.NET?
Is there any section or code which allows us to set default page in web.config?
For example, when people first visit my website, I want them to see CreateThing.aspx rather than Default.aspx.
The ...
130
votes
6
answers
300k
views
"An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page..."
I'm trying to publish an MVC website as an Azure webrole.
When I run it locally, everything works fine.
But once I publish it to Azure and surf to some MVC action, I get this error:
Server Error ...
130
votes
12
answers
245k
views
Access-control-allow-origin with multiple domains
In my web.config I would like to specify more than one domain for the access-control-allow-origin directive. I don't want to use *. I've tried this syntax:
<add name="Access-Control-Allow-Origin" ...
124
votes
20
answers
138k
views
The name 'ViewBag' does not exist in the current context - Visual Studio 2015
I'm starting to develop in ASP.NET again and I ran into a small error within Visual Studio. My .cshtml files show errors when using a few razor functions. For example "The name 'ViewBag' does not ...
118
votes
4
answers
91k
views
What are the Web.Debug.config and Web.Release.Config files for?
I just upgraded to Visual Studio 2010 and MVC 2.0 and I noticed the Web.config has two additional files attached to it? Are these files used to specify debug and release specific settings, so you don'...
115
votes
7
answers
182k
views
Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive
I just installed vs 2010, followed by IIS in window 7. when building a website in .net framework 4.0 and convert this into application in IIS then its shows this error
If i remove the ...
110
votes
2
answers
38k
views
Web Config Transformation to add a child element
I've got the following configuration in web.config:
<resizer>
<sizelimits imageWidth="0" />
<plugins>
<add name="MvcRoutingShim" />
<!--<add name="...
109
votes
23
answers
177k
views
No assembly found containing an OwinStartupAttribute Error
This error
The following errors occurred while attempting to load the app.
- No assembly found containing an OwinStartupAttribute.
- The given type or method 'false' was not found. Try specifying ...
107
votes
7
answers
137k
views
How to read appSettings section in the web.config file?
My XML looks like this and the filename is web.config
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="configFile" value="IIS.config"/>
<add key="...
106
votes
9
answers
103k
views
Authentication issue when debugging in VS2013 - iis express
I'm trying to pick up the windows username when debugging in Visual Studio 2013. I am simply using:
httpcontext.current.user.identity.name
If I run this on my Dev Server it works fine, if I run it ...
106
votes
10
answers
92k
views
Web Config Transform not working
In a .NET MVC 3.0 Application I have the following configuration in appSettings:
web.config
<appSettings>
<add key="SMTPHost" value="mail.domain.com"/>
<add key="SMTPUsername" ...
104
votes
6
answers
160k
views
Read Variable from Web.Config
How can I add and read the value from web.config file?
101
votes
15
answers
733k
views
Setting up connection string in ASP.NET to SQL SERVER
I'm trying to set up a connecting string in my web.config file (Visual Studio 2008/ASP.NET 3.5) to a local server (SQL server 2008).
In my web.config, how and where do I place the connection string?
...
101
votes
3
answers
132k
views
Escape quote in web.config connection string
I have a connection string in my web config:
<add name="MyConString" connectionString="Server=dbsrv;User ID=myDbUser;Password=somepass"word" providerName="System.Data.SqlClient" />
As you see, ...
100
votes
15
answers
161k
views
Variables within app.config/web.config
Is it is possible to do something like the following in the app.config or web.config files?
<appSettings>
<add key="MyBaseDir" value="C:\MyBase" />
<add key="Dir1" value="[MyBaseDir]\...
98
votes
7
answers
44k
views
ASP.Net Web Application Add Config Transform Grayed Out
I added an existing ASP.Net web application project to my solution. In addition to the standard debug and release configurations this solution also has two custom configurations, SAT and UAT. For the ...
98
votes
4
answers
124k
views
Change a web.config programmatically with C# (.NET)
How can I modify / manipulate the web.config programmatically with C# ? Can I use a configuration object, and, if yes, how can I load the web.config into a configuration object ? I would like to have ...
98
votes
9
answers
27k
views
Developer specific app.config/web.config files in Visual Studio
We have several .NET projects where we store certain settings in configuration files.
Now each developer will have their own configuration files that differ a little (different connection strings to ...
97
votes
2
answers
22k
views
ReplacableToken_ when using web.config transform?
I have a web.config with 2 transforms - for debug and release.
web.config:
<connectionStrings>
<clear />
<add name="StrName" connectionString="data source=.\sqlexpress;User Id=...
94
votes
4
answers
44k
views
What does the Web.Config file do in the views folder of a MVC project
I'm having some problems with deploying my application and while troubleshooting, I came across the Web.Config file in the Views folder. In an attempt to narrow down the possibilities of sources to my ...
92
votes
4
answers
130k
views
Web.Config Debug/Release
I know that web.config in Visual Studio 2010 provides the ability to switch from databases from Debug mode to Release mode.
Here is my Web.Release.config:
<?xml version="1.0"?>
<!-- For ...
88
votes
7
answers
127k
views
How do you modify the web.config appSettings at runtime?
I am confused on how to modify the web.config appSettings values at runtime. For example, I have this appSettings section:
<appSettings>
<add key="productspagedesc" value="TODO: Edit this ...
87
votes
3
answers
68k
views
how to add files in web.config transformation process?
I am having a website developed in Visual Studio 2012.
The web.config is currently containing following files in its transformation:
- web.Debug.config
- web.Release.config
I have recently added a ...
86
votes
9
answers
217k
views
IIS Config Error - This configuration section cannot be used at this path
I am getting the below error when I try to run my website.
The website is hosted on Windows 2012 R2.
Config error: This configuration section cannot be used at this path. This happens when the ...
83
votes
7
answers
36k
views
How can I use Web.debug.config in the built-in visual studio debugger server?
How can I merge and make use of Web.debug.config in visual studio 2010 built-in debugger?
81
votes
2
answers
58k
views
How to remove a ConnectionString using Config Transformations
I have a Web.config with several ConnectionStrings
<connectionStrings>
<add name="connStr1" connectionString="...
<add name="ConnStr2" connectionString="...
<add name="...