473,779 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

connects only in debug mode

BeemerBiker
87 New Member
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 AccessDataSourc e 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 3484
BeemerBiker
87 New Member
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 Recognized Expert Moderator Expert
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
shressun
1 New Member
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
BeemerBiker
87 New Member
@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
3373
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 is going wonky. Now, the "proper" way to debug a DLL is apparently to build Python in debug mode (i.e. with the _d form dll), then build each and every extension I depend on (in debug mode), and then build each of my own extensions in debug...
4
2104
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 to setup debugging for a Windows Form control. I cannot find any documentation or articles on setting up the same facility for a Web control. Any help on setting the control library project to debug the design-time code would be greatly...
12
3422
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 the documentation wrong? I've been load testing an ASP.NET website (built in VS.NET 2003 in C#). I've used the ACT to generate heavy loads over several minutes. Debug or no debug produces almost identical performance results.
7
2915
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 using the following code in Page_Load event handler. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim intcount As Integer intcount = 0 For intcount = 0 To 4
3
4036
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: " + _columns.Count + "\n"; }
6
3665
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 I am in debugging mode as indicated by a preprocessor directive: #define DEBUG In other words, I need code which says "Whenever I write debug <<
2
2708
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 in("myfile.txt"); float value; in >value; //The crash happens here in the getloc() function The above code is actually from a library built in Debug mode that is linked into the Release build of the executable. Does anyone have any
0
1739
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
3380
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 using Debug mode. Now we are ready to compile everything for release to production. However, we don’t know whether we should compile all the applications/components/assemblies using Release mode (or keep everything in Debug mode). We’ve...
0
9636
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9930
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.