Solved

ASPNET login failure in Visual Studio / MDSE environment

Posted on 2004-04-11
5
1,014 Views
Last Modified: 2009-07-29
Based on my searches, this problem happens a lot. I am a rookie and have attempted these solution and have gotten nowhere.

 I am working (just starting) in a Visual Studio .NET environment using VB. Trying to get the ASP.NET Web App. Walkthrough to work. I can see that I am able to access the “pubs” database through via the via the VS/VB wizards. But at run time it doesn’t work.

Here’s part of the text of the message:
...
Login failed for user 'CSCHERL-D4500\ASPNET'.
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: Login failed for user 'CSCHERL-D4500\ASPNET'.  Source Error:
...

Here is what I have tried with no change in the message.

1.      Using the WIN XP Control panel I created a ASPNET admin user account with no password. I didn’t think that it would work as I was not setting this user up in the SQL Server.

2.      I found what I thought was the solution here:
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_20728747.html?query=Login+failed+for+user+ASPNET+&searchType=all

I tried building the .bat file and making the appropriate substitution to add the user to the MSDE SQL Server. Here’s what I tried

cd "C:\Program Files\Microsoft SQL Server\80\Tools\Binn"  
osql -E -S CSCHERL-D4500\MSSQLServer r -Q "sp_grantlogin 'CSCHERL-D4500\ASPNET'"
osql -E -S CSCHERL-D4500\MSSQLServer -d pubs-Q "sp_grantdbaccess 'CSCHERL-D4500\ASPNET'"
osql -E -S CSCHERL-D4500\MSSQLServer -d pubs -Q "sp_addrolemember 'db_owner', 'CSCHERL-D4500\ASPNET'
pause


Here’s what I get:
...
C:\Program Files\Microsoft SQL Server\80\Tools\Binn>osql -E -S CSCHERL-D4500\MSSQLServer -Q "sp_grantlogin 'CSCHERL-D4500\ASPNET'"  
[DBMSLPCN]Invalid connection.
[DBMSLPCN]ConnectionOpen (ParseConnectParams()).
...

It seems pretty clear that I have a bad connection. I suspect that my “instance” of the SQLServer is improperly specified. The SQL Service Manager running in the task tray says the following:

Server:CSCHERL-D4500
Services:SQL Server
At the bottom of the box [Running - \\CSCHERL-D4500 – MSSQLServer]

Am I even close to solving this problem???

Is there a possible problem in the “Component Designer generated code”???

What do I need to do and how (very clearly for this dummy) do I do it?

Help!!!!

ChuckS
0
Comment
Question by:blindrookie
  • 3
  • 2
5 Comments
 
LVL 9

Expert Comment

by:glsac
ID: 10801949
0
 

Author Comment

by:blindrookie
ID: 10805595
I certainly do appreciate the references .... however I can find nothing that tells me how to:
1. create userids for virtual servers such as IIS & SQL
2. assign permissions etc.
3. exactly where in the web.config files things need to be placed
As I mentioned before, I am not certain that I ma on the right track.
0
 
LVL 9

Accepted Solution

by:
glsac earned 125 total points
ID: 10806088
<system.web>
    <identity impersonate="true" />
</system.web>

In short this is what the articles say...put that in your web.config and tell me if it works...you should not have to add ASPNET process to sql server.

-Joe
0
 

Author Comment

by:blindrookie
ID: 10809043
After posting my comments, I found modifaction to the connection string on MS Knowledge Base which was referenced by one of your articles.
I changed this code which was generated by VS:
...
       Me.SqlConnection1.ConnectionString = "workstation id=""CSCHERL-D4500"";packet size=4096;integrated security=SSPI;data sou" & _
        "rce=""cscherl-d4500"";persist security info=False;initial catalog=pubs"
...
to this:
...
        'Me.SqlConnection1.ConnectionString = "workstation id=""CSCHERL-D4500"";packet size=4096;integrated security=SSPI;data sou" & _
        '"rce=""cscherl-d4500"";persist security info=False;initial catalog=pubs;server=""CSCHERL-D4500"";uid=sa"
...
This worked and I was able to see the database display.
When I got your <identity impersonate>, I backed out the above change to see if it would also work prior to implementing your fix. The now works with the old code!!!!!!!
...
I then installed your fix and the application still works.

The problem is solved and now I can't and I am not certain why.

I am not going to worry about it now .... but if you have any comments I would appreciate it.

Thanks for the help
 
0
 
LVL 9

Expert Comment

by:glsac
ID: 10809140
:) happy it works!

-Joe
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 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