Solved

Login failed for user 'Domain\MachineName$' asp.net app deployment

Posted on 2004-10-29
1,325 Views
Last Modified: 2012-06-21
WILL CROSS POST ON "SQL SERVER" FORUM

Hi,

We are trying to deploy an asp.net app. to a Windows Server 2003 running SQL Server.  When we try to access the DB we receive the following error :-

Login failed for user 'Domain\MachineName$'

We "think" we have set all correct user logins but can't be 100% sure as we cannot find any finite documentation on this and what we have found seems to apply to "NetWork security" users and ASPNET users but nothing relating directly to the machine account.

Any thoughts would be much appreciated.

James.
0
Question by:JAMES
    7 Comments
     
    LVL 25

    Accepted Solution

    by:
    James,

    You will need to enable both Windows and SQL Server authentication in the SQL Server Properties. After enable that option, you can create a specific database user to connect to the SQL Server. If Windows Authentication is not used in ASP .NET app, then the SQL Server connection is accessed by ASPNET account that has very minimum privileges and under default installation, no permissions at all to access the SQL server. Visit http://www.connectionstrings.com to learn more about the connection string format.

    Best, Nauman.
    0
     
    LVL 25

    Expert Comment

    by:nauman_ahmed
    Here is an example from connectionstrings.com web site:

    Standard Security:

    "Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
       - or -
    "Server=Aron1;Database=pubs;User ID=sa;Password=asdasd;Trusted_Connection=False"
       (booth connection strings produces the same result)




     Trusted Connection:

    "Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
       - or -
    "Server=Aron1;Database=pubs;Trusted_Connection=True;"
       (booth connection strings produces the same result)

    (use serverName\instanceName as Data Source to use an specifik SQLServer instance, only SQLServer2000)
     Connect via an IP address:

    "Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;"
    (DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default))
     Declare the SqlConnection:

    C#:
    using System.Data.SqlClient;
    SqlConnection oSQLConn = new SqlConnection();
    oSQLConn.ConnectionString="my connectionstring";
    oSQLConn.Open();



    VB.NET:
    Imports System.Data.SqlClient
    Dim oSQLConn As SqlConnection = New SqlConnection()
    oSQLConn.ConnectionString="my connectionstring"
    oSQLConn.Open()

    HTH, Nauman.
    0
     

    Author Comment

    by:JAMES
    Nauman,

    I will check the link out and report back...

    Here is our connection string - is this wrong?

    workstation id="JAMES-X31";packet size=4096;user id=sa;data source=R2D2;persist security info=True;initial catalog=Reality;password=MyPassword

    Where R2D2 is the IIS6 / DB Server and JAMES-X31 is the development machine (does this matter).

    Thanks.
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    Standard Security:
    "Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
       - or -
    "Server=Aron1;Database=pubs;User ID=sa;Password=asdasd;Trusted_Connection=False"

    Aeros
    0
     
    LVL 25

    Expert Comment

    by:nauman_ahmed
    I use the following connectionstring to connect to SQL server:

    Data Source=192.168.0.2,1433;Network Library=DBMSSOCN;Initial Catalog=Northwind;User ID=sa;Password=password;

    Best, Nauman.
    0
     
    LVL 17

    Expert Comment

    by:AerosSaga
    Login failed for user 'Domain\MachineName$'

    shouldn't it be Domain\USER???
    0
     
    LVL 26

    Expert Comment

    by:Rejojohny
    what kind of authentication is specified for ur web application ... i.e. anonymous, basic, windows etc ..

    u will need to impersonate the current user .. so u have to add the tag in the web.config file ..

    <system.web>
        <identity impersonate="true"/>
    ......


    check out this link .. explanation in detail ..

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetAP05.asp
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Anonabox PRO Tor & VPN Router

    PRO is the most advanced way to fortify your privacy and online anonymity by layering the Tor network with VPN services. Use both together or separately, and without needing to download software onto your devices.

    I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    This video Micro Tutorial is the second in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 (http://www.experts-exchange.com/articles/17490/). But the ability to create custom scanning profiles a…
    This video discusses moving either the default database or any database to a new volume.

    860 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