Webconfig error.

Posted on 2007-12-02
Last Modified: 2013-11-07
I thought it might be a database error. Now I think it is a web.config.
Server Error in '/Cms' Application.

Cannot open database "CMS" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Cannot open database "CMS" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

<?xml version="1.0"?>


    Note: As an alternative to hand editing this file you can use the 

    web admin tool to configure settings for your application. Use

    the Website->Asp.Net Configuration option in Visual Studio.

    A full list of settings and comments can be found in 

    machine.config.comments usually located in 



<configuration xmlns="">


    <add key="FCKeditor:UserFilesPath" value="/Cms/UserFiles"/>



     <add name="Cms" connectionString="Data Source=Quincy;Initial Catalog=CMS;Integrated Security=True;" providerName="System.Data.SqlClient" />




      Set compilation debug="true" to insert debugging 

      symbols into the compiled page. Because this 

      affects performance, set this value to true only 

      during development.

      Visual Basic options:

      Set strict="true" to disallow all data type conversions 

      where data loss can occur. 

      Set explicit="true" to force declaration of all variables.


    <compilation debug="true" strict="false" explicit="true" />

    <roleManager defaultProvider="SqlProvider"








        cookieProtection="All" >





          connectionStringName="Cms" />



    <membership defaultProvider="SqlProvider">


        <add name="SqlProvider"

            type="System.Web.Security.SqlMembershipProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"










            passwordStrengthRegularExpression="" />



    <authentication mode="Forms">

      <forms loginUrl="~/Login.aspx" />




      <allow users="*"/>


    <pages theme="Cms">


        <clear />

        <add namespace="System" />

        <add namespace="System.Collections" />

        <add namespace="System.Collections.Specialized" />

        <add namespace="System.Configuration" />

        <add namespace="System.Text" />

        <add namespace="System.Text.RegularExpressions" />

        <add namespace="System.Web" />

        <add namespace="System.Web.Caching" />

        <add namespace="System.Web.SessionState" />

        <add namespace="System.Web.Security" />

        <add namespace="System.Web.Profile" />

        <add namespace="System.Web.UI" />

        <add namespace="System.Web.UI.WebControls" />

        <add namespace="System.Web.UI.WebControls.WebParts" />

        <add namespace="System.Web.UI.HtmlControls" />




            The <authentication> section enables configuration 

            of the security authentication mode used by 

            ASP.NET to identify an incoming user. 



            The <customErrors> section enables configuration 

            of what to do if/when an unhandled error occurs 

            during the execution of a request. Specifically, 

            it enables developers to configure html error pages 

            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">

            <error statusCode="403" redirect="NoAccess.htm" />

            <error statusCode="404" redirect="FileNotFound.htm" />




  <location path="Management">



        <allow roles="Administrator" />

        <deny users="*"/>





Open in new window

Question by:mathieu_cupryk
LVL 16

Accepted Solution

TSmooth earned 250 total points
ID: 20393386
Your connection string is using integrated security but you don't have impersonation in use so the account that runs as (Network Service in your case) is trying to connect to the database but doesn't have permission to. You can fix this by either:

1.) Give Network service permission to the database.
2.) Create a SQL Server login and have your connection string use that instead of integrated security/windows authentication.
3.) Enable impersonation on your website so that the service runs as a specific account or namely, the account that the user accessing the site is logged in as. This option will generally only work for you in an intranet environment.

Expert Comment

ID: 20394765
try this

go to IIS --> your Web Site properties --> ASP.NET tab --> Change ASP.NET version to 1.1 and then change back to 2.0.


Author Closing Comment

ID: 31412249
This works ok. Thanks bud.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Get id from json Data with NewtonSoft 3 34
Class object 2 27
Split in Javascript 5 31
Webform example, External Authentication Services, OAUTH, 4.6.2 1 15
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now