473,387 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

connects only in debug mode

BeemerBiker
My asp.net app can connect to the sql server when running in debug mode, VS2008.

It will not connect at the published location using
Expand|Select|Wrap|Line Numbers
  1. http://localhost/...default.aspx
.etc

Connection string
Expand|Select|Wrap|Line Numbers
  1. Data Source=SWRI16SQL1;Initial Catalog=training09;Integrated Security=SSPI; 

Error message at the connection "open" statement:

Login failed for user ''. The user is not associated with a trusted SQL Server connection.

Note that the "user" was empty ie: '' as shown above.

The entire app worked fine and the web page could be accessed by anyone on my domain right up to the time I switched from AccessDataSource to SqlDataSource.

Anyway, just wondering how to debug this. All the queries and reports actually work and the remote sql server responds with the correct data, but only if I had hit F5 (debug) in Visual Studio 2008. Obviously, no one can access it because they get that trusted SQL complaint and I also get the same complaint when using localhost

best regards
Mar 31 '09 #1
4 3464
I am posting this here because I never got an answer on the IIs forum.

I switched from access to ms sql for my asp.net program and I can only access the sql server when running my web app in debug mode on visual studio. I am (was) using Sql Express from Vs2005 and I put in the free Sql Studio. The database shows up just find in the database explorer and I can create tables, etc from the explorer or studio. If I publish to localhost and try to run my app then I cant make a sql connection. Our IT guy came in last friday to help me, but even he was stumped. We transfered the database to his sql server, and I reset the connection string to his but the same thing happened. It works fine in debug mode but not when published to my system.

Error: "the user is not associated with a trusted SQL server connection" but this error is too generic and googleing I cannot find anything useful.



Nothing like this ever happened on my other web app with postgresql on an external linux server so I assume it is some type of windows thing.

I am building for dotnet 3.5 and running on an XP system that is up-to-date but am not using any dotnet 3.5 stuff.
Apr 6 '09 #2
Frinavale
9,735 Expert Mod 8TB
Hmm I haven't really had a lot of experience using Integrated Security before, so I'd be tempted to recommend that you should try using SQL Server Authentication instead of Windows Authentication.

ASP.NET applications run under low trust levels and so you may have to use impersonation in order to use an account with enough permissions in order to connect to the database.

I've found that Visual Studio uses the current user's permission levels (your account permissions) while debugging. IIS does not use your account, it uses the ASPNET account (or whatever they call it now, regardless it has low trust/security levels). So to get around this you're going to have to create a Windows User account that has the proper permissions to connect to the SQL server and have the ASP.NET application use this account (impersonation) to connect to the database.
Apr 6 '09 #3
Not sure if you have resolved this. I think that you may have to modify your web.config to include impersonation. Came across this:

http://shailkpatel.blogspot.com/2007...onnection.html

Hope it helps

Sunil
Apr 24 '09 #4
@shressun
Thanks for that link. I forwarded it to our IT staff. Last month, they did a lot of handwaving and googleing and announced that it was just my connection string. However, the connection string they gave me was the same one that didnt work the previous week when they started on my problem. When that same connection string did not work for a colleague, they got rid of windows authentication and went to sql authentication and "anonymous access" whatever that is. I have since retired so it is someone elses problem. Every engineer I talked with at work wants to use postgresql, mysql, and linux, and the IT staff is slowly losing its turf as it is stuck on windows.
Apr 24 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mike C. Fletcher | last post by:
Every few months I get to working on a Python C extension (built with distutils) and discover a pointer error or the like where I'd like to be able to step into my DLL and see where the extension...
4
by: jim | last post by:
I am trying to debug a user written web control and web control designer. I found an article “Building Windows Forms Controls and Component with Rich Design-Time Features” that describes how...
12
by: nospam | last post by:
All the documentation says that leaving an ASP.NET application in debug mode has a big performance hit. I can't detect any difference between debug and non-debug modes. Am I missing something or is...
7
by: Srinivasa Rao | last post by:
I have read in one article that when we compile the application in release mode, all the debug classes and properties will be automatically removed from the code. I tried to implement this thing by...
3
by: Haldun ALIML | last post by:
Suppose that you have below property in some class, #if DEBUG public string DebugInfo { get { return "INDEX : " + _name + "\n" + "Index Owner : " + _owner.Name + "\n" + "Index Column Count:...
6
by: pauldepstein | last post by:
To help me debug, I am writing a lot of information into a stream which I call debug. However, because of the large amount of time taken to print this information, I only want this printed while...
2
by: Dave Johansen | last post by:
I just converted a solution from Visual Studio 2003 to Visual Studio 2005 and the Debug mode seems to be running just fine, but the Release mode crashes on the following code: std::ifstream...
0
by: =?Utf-8?B?SmVmLnB0Yw==?= | last post by:
Hi, I am currently facing exactly the same issue with Visual Studio 2005. Did you find a way to solve this problem ? "AntonioSACE" wrote:
3
by: =?Utf-8?B?bG10dGFn?= | last post by:
We have developed a number of different applications (ASP.NET web site, Windows services, DLLs, Windows forms, etc.) in C# 2.0. We have developed and unit tested all these applications/components...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.