SQL Server does not exist or access denied

Ask a Question related to ASP.NET General, Design and Development.

  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. Similar Questions and Discussions

    1. SQL Server does not exist or access denied.
      Hi, I had the same issues. I ended up learning more about SQL that I had intended. In the end I discovered that GrocerToGo had not been installed...
    2. Access Denied. The file may not exist,...
      Hello everyone, I have no idea why this issue keeps poping up... what have i done wrong... any ideas here is the error message... Access...
    3. "Server does not exist or access is denied"
      Hi, I am trying to connect a web service to an SQL Server 2000 database. SQL Server is installed and started and the database appears on the...
    4. Error: SQL Server does not exist or access denied
      My client has a server running Windows 2003 Server and SQL Server 2000. The sole purpose of the server is to run a single web site. It was...
    5. SQL Server does not exist or access denied. - nothings changed
      Everything has worked fine for about a month, then all of a sudden I get this error message: Sql server access denied or does not exist. I...
  3. #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

  4. #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

  5. #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 analyzer, 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

  6. #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

  7. #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

  8. #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

  9. #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

Posting Permissions

  • You may not post new threads
  • You may 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