[.net] debug in asp.net

Started by
3 comments, last by capn_midnight 14 years, 1 month ago
hi, i create a function like this private void xxx() { int x = 0; sqlconnect cn; string sql = "insert ......"; ..... execute sql command } i debug it in step over, when the program run and stop at first line, i stop it, but the following code still run util exit function, why?
Advertisement
I am not quite sure whether I understand your question or not.

Can you trace the database? By adding tracing you could make sure that you are correctly connecting to the database. Try running the query directly in the database so you know that the query is correct.
It doesn't stop the execution of the page because you're only debugging the web application, you're not debugging the server that is executing the application. If all you did was hit F5 without any extra setup, then you're using the built-in ASP.NET Development Server, in which case it *should* stop when you stop the debugger. However, if you set up your application to execute in IIS, then the debugger can't shut down IIS when you stop the debugger, so IIS will finish processing the last request while Visual Studio closes the browser window.

BTW, stop building queries in strings in your application code. Use a stored procedure.

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

I see, but how should i set configure to debug in build-in server?
right click your project in the Solution Explorer in Visual Studio and select "Properties". In this window, select the "Web" tab. Under the "Servers" selection, check the "Use Visual Studio Development Server" radio button.

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

This topic is closed to new replies.

Advertisement