Professional Web Applications Themes

SQL Server does not exist or access denied - ASP.NET General

Problem: ======= Coonection String: <add key="TaxonomyConnection" value="User ID=WebUser;Password='pass';Initial Catalog=Taxonomy;Data Source=spectre;Network Library =dbmssocn" /> If that is true, then why is the web.config included in the deployment? When he changed the string (added the Network Library attribute to force TCP/IP) then does that mean the application was still using the string as compiled and not picking up the change? That connection string is then declared as a global string variable in the global.asax codebehind as Public Const CfgTaxonomyConnection As String = "TaxonomyConnection" In the WebForm codebehind pages he is using the Data Access Application Blocks which look something like this Dim ...

  1. #1

    Default RE: SQL Server does not exist or access denied

    Problem:
    =======
    Coonection String:
    <add key="TaxonomyConnection" value="User
    ID=WebUser;Password='pass';Initial Catalog=Taxonomy;Data
    Source=spectre;Network Library =dbmssocn" />

    If that is true, then why is the web.config included in
    the deployment? When he changed the string (added the
    Network Library attribute to force TCP/IP) then does that
    mean the application was still using the string as
    compiled and not picking up the change?

    That connection string is then declared as a global
    string variable in the global.asax codebehind as

    Public Const CfgTaxonomyConnection As String
    = "TaxonomyConnection"

    In the WebForm codebehind pages he is using the Data
    Access Application Blocks which look something like this

    Dim dsData As DataSet =
    DataAccessLayer.SqlHelper.ExecuteDataset
    (ConfigurationSettings.AppSettings
    (Global.CfgTaxonomyConnection), "usp_GetKingdoms")

    Remember, this code works well from my development
    workstation but fails when deployed to the intermediate
    machine.


    Solution:
    =======

    Building Secure ASP.NET Applications: Authentication, Authorization, and
    Secure Communication
    ASP.NET Security
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/ht[/url]
    ml/SecNetch08.asp

    Here's the section of this article that you may find it useful:

    "When the application is not configured for impersonation, the ASP.NET
    process identity provides
    the default identity when your application attempts to access remote
    resources. If you want to use the
    ASP.NET process account for remote resource access, you have three options:

    Use mirrored accounts.
    This is the simplest approach. You create a local account with a matching
    user name and password on
    the remote computer. You must change the ASPNET account password in User
    Manager to a known
    value (always use a strong password). You must then explicitly set this on
    the <processModel> element
    in Machine.config, and replace the existing "AutoGenerate" value.


    Bassel Tabbara [MSFT] Guest

  2. #2

    Default SQL Server does not exist or access denied

    Hi

    Are you using named instances of SQL Server?
    First check whether u r able to connect to SQL Server to
    SQL Enterpraise manager


    HTH
    Ravikanth


    >-----Original Message-----
    >I am running an asp.net application on my development
    >machine (Win2K, .NET framework). This prog connects to
    a
    >SQL Server (on another machine).
    >When I run the following code it errors with the
    following
    >message: "SQL Server does not exist or access denied"
    >
    >Dim strConnect As String = Application("CONN")
    >Dim cnIntranet As New SqlConnection(strConnect)
    >Try
    > cnIntranet.Open()
    >Catch ex As SqlException
    > Response.Write(ex.Message & "<BR>")
    > Return
    >End Try
    >
    >'Where
    >'Application("CONN")
    >= "server=servername;database=dbname;uid=loginname;p wd=ab
    cd
    >efg"
    >
    >However if I copy the project up to the production
    >Intranet server (Win2k) it works fine (pointing at the
    >same sql server as when it doesn't work).
    >I haven't done anything on the SQL server to allow
    access
    >from the production Intranet server but it works from
    >there, but not my local IIS.
    >
    >I know this is probably a basic security problem but
    >having searched the internet I can't find a soln.
    >
    >Regards
    >.
    >
    Ravikanth[MVP] Guest

  3. #3

    Default Re: SQL Server does not exist or access denied

    Hi,

    Check if the SQL server set to work with windows authentication. If so,
    check if your client web application set to use anonymous user while the
    server application isnít.

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

  4. #4

    Default SQL Server does not exist or access denied

    Thanks for reply. I am able to connect to this sql server
    by many others means (query yzer, enterprise mgr and
    also the same .net app when running from production
    server). It's only when I run it from LOCAL iis it doesn't
    work.
    If by "named instance" you mean using the actual name as
    opposed to IP address? then yes, I'm using the actual name
    of the server.
    >-----Original Message-----
    >Hi
    >
    >Are you using named instances of SQL Server?
    >First check whether u r able to connect to SQL Server to
    >SQL Enterpraise manager
    >
    >
    >HTH
    >Ravikanth
    >
    >
    Fiona Wallace Guest

  5. #5

    Default Re: SQL Server does not exist or access denied

    Thanks for reply. SQL is set to use mixed authentication
    (sql server and windows authentication). My local client
    web app was indeed set up to use anonymous (and the
    production server wasn't). I set the local to match the
    production, but still no luck. I'm getting the same error
    (I also restarted too for good measure).
    I've had a look at all the other settings and can't see
    any differences.

    Fiona Wallace Guest

  6. #6

    Default Re: SQL Server does not exist or access denied

    Try to add Impersonate=true in your web.config

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

  7. #7

    Default Re: SQL Server does not exist or access denied

    Thankyou very much!
    Adding <identity impersonate="true"/> has made it work.

    Is there a way I can set this as a default? Or will I have to add this
    line to the project's web.config for every project I develop locally?

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Fiona Wallace Guest

  8. #8

    Default Re: SQL Server does not exist or access denied

    managed to answer my own question: add impersonate="true" in
    machine.config rather than individual web.config files.
    Thanks for everyone's help.

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Fiona Wallace Guest

  9. #9

    Default SQL Server does not exist or access denied

    Here is a new error I am getting.

    I have a development computer (Server 2000, SQL2000, .NET 1.1)
    I have a production computer (Server 2003, SQL2000, .NET 1.1)

    When I run my solution on the development box pointing to the database on
    the development box - no problem.
    When I run my solution on the production box pointing to the database on the
    production box - no problem.
    When I run my solution on the production box pointing to the database on the
    development box - no problem.

    When I run my solution on the development box pointing to the database on
    the production box - problem.

    Here is the error message:
    Exception Details: System.Data.SqlClient.SqlException: SQL Server does not
    exist or access denied.

    Here is my connection string in the web.config file:
    <add key="ConnectionString" value="user id=ssboot; password=pwd; initial
    catalog=archi; data source=scics-dotnet1,1433; Network Library =dbmssocn;
    Connect Timeout=5; pooling=true"/>

    I have am out of ideas on what to try to fix this problem. From my
    development box I have no problem connecting to the production database
    through server explorer in the .NET IDE.

    Any help would be appreciated.

    Thanks,
    Marc.


    Marc Guest

Similar Threads

  1. SQL Server does not exist or access denied.
    By John Toop in forum ASP.NET Security
    Replies: 12
    Last Post: August 31st, 01:57 PM
  2. Access Denied. The file may not exist,...
    By Inquisitive8 in forum Macromedia Contribute General Discussion
    Replies: 0
    Last Post: May 25th, 03:42 PM
  3. "Server does not exist or access is denied"
    By CAN'T SEE THE SERVER FROM VS SERVER EXPL in forum ASP.NET Web Services
    Replies: 0
    Last Post: April 6th, 05:51 AM
  4. Error: SQL Server does not exist or access denied
    By Dave Navarro in forum ASP Database
    Replies: 14
    Last Post: April 14th, 04:39 PM
  5. Replies: 3
    Last Post: February 20th, 11:57 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139