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,695
            questions
        
        
            497
            votes
        
        
            38
            answers
        
        
            521k
            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 ...
            
        
       
    
            283
            votes
        
        
            4
            answers
        
        
            125k
            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="...
            
        
       
    
            274
            votes
        
        
            12
            answers
        
        
            459k
            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 ...
            
        
       
    
            260
            votes
        
        
            12
            answers
        
        
            203k
            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 ...
            
        
       
    
            254
            votes
        
        
            10
            answers
        
        
            319k
            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 ...
            
        
       
    
            239
            votes
        
        
            4
            answers
        
        
            119k
            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=&...
            
        
       
    
            220
            votes
        
        
            31
            answers
        
        
            399k
            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, ...
            
        
       
    
            214
            votes
        
        
            10
            answers
        
        
            179k
            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
        
        
            68k
            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
        
        
            75k
            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
        
        
            90k
            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?
            
        
       
    
            183
            votes
        
        
            3
            answers
        
        
            345k
            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 ...
            
        
       
    
            182
            votes
        
        
            8
            answers
        
        
            561k
            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
            
        
       
    
            175
            votes
        
        
            6
            answers
        
        
            106k
            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 --&...
            
        
       
    
            172
            votes
        
        
            23
            answers
        
        
            281k
            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 ...
            
        
       
    
            169
            votes
        
        
            10
            answers
        
        
            291k
            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 - ...
            
        
       
    
            169
            votes
        
        
            7
            answers
        
        
            210k
            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
        
        
            96k
            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
        
        
            174k
            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
        
        
            294k
            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 ...
            
        
       
    
            150
            votes
        
        
            1
            answer
        
        
            186k
            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:
  ...
            
        
       
    
            139
            votes
        
        
            2
            answers
        
        
            57k
            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
        
        
            234k
            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
        
        
            295k
            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
        
        
            242k
            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" ...
            
        
       
    
            122
            votes
        
        
            20
            answers
        
        
            136k
            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
        
        
            90k
            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
        
        
            175k
            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 ...
            
        
       
    
            105
            votes
        
        
            10
            answers
        
        
            90k
            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
        
        
            730k
            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?
...
            
        
       
    
            99
            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
        
        
            3
            answers
        
        
            131k
            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, ...
            
        
       
    
            98
            votes
        
        
            4
            answers
        
        
            123k
            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 ...
            
        
       
    
            96
            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 ...
            
        
       
    
            96
            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
        
        
            126k
            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 ...
            
        
       
    
            86
            votes
        
        
            9
            answers
        
        
            214k
            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 ...
            
        
       
    
            86
            votes
        
        
            3
            answers
        
        
            67k
            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 ...
            
        
       
    
            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="...