Website stops responding - asp.net

It stops responding after a few seconds of being idle. I have to restart it every time this happens.
I have tried putting startMode="AlwaysRunning" into my applicationHost config, but nothing changed.
The output of the console is just a bunch of
The thread X has exited with code 0 (0x0).
I don't think this is related to idleTimeOut either, because the website completely stops responding; it just hangs.
applicationHost if anyone is interested (too large to post here):
http://pastebin.com/quVMXPHP
Let me know if you need further information.

Are you sure it's from being idle? By default, every time you stop debugging, IIS Express unloads the website, and quits entirely if there's no other websites running. You can disable this by unchecking Enable Edit and Continue in the project properties under the "Web" tab.
If it happens more randomly, then IIS Express may actually be crashing. Check in the notification area of the taskbar for IIS Express, make sure it's there, and (by right-clicking) ensure your web project is still loaded (in the list). If it's actually crashing, you most likely have a memory leak, infinite loop, or something similar going on somewhere in your application that's overloading the process. There's no much we can do to help you with that, without being able to examine your entire codebase. You'll just have to trace and profile until you find it.

Related

Allow long running admin page in Sitecore

I've got an admin .aspx page that I need to run on an instance to iterate through a bunch of items and fix some Worflow fields that aren't set properly. It's got to get through a lot of items. I ran it on my dev machine and it worked fine. It took a really long time, but completed.
Now, I'm trying to run the same page in the client's environment and I keep getting an HttpException: Request timed out error.
I just need to run this thing once. Any thoughts on why it won't run there and how to make it so I can get it to complete?
In .NET There is a executionTimeout. This time-out applies only if the debug attribute in the compilation element is False. This can explain the different behavior on your dev vs production
msdn
An other option is the app pool recycle setting.
Try the following:
Open IIS, and Select "Advanced Settings" for your Application Pool
Set the Ping Maximum Response Time to a larger number, note its in seconds
Reset those values back to the original value, once the task is done
Hope This helps

Very long load times for the initial view in MVC3

I have an intermittent problem where whatever view I set as my starting view, for my MVC3 project, in VS 2010, I get extremely long long load times. I'm now looking at over 2 minutes without anything happening except the browser waiting. I am working with a local DB on my dev machine, and the build time for the project is quick. If I stop to debug in VS, none of my code is running.
When I stop debugging in VS, which takes very long as well, then I finally get a 404 in the browser. What could be causing this, and what measures can I take to diagnose and resolve this issue?
I am using the VS built-in web server, not IIS, and VS 2010 Pro, so no IntelliTrace options.
NEW: When I tried a machine restart, my machine seemed to hang up on the 'logging off' message. I tried the restart because I experienced problems even accessing my C:\Development folder, also unexplained hanging. After the restart, on trying to run the project again, I immediately got a compilation error. That error was there from before the restart, and I suspect it had something to do with the total meltdown, but it's a simple misspelled property name in a view.
After fixing the compilation error, things are back to normal.
Try turning off IntelliTrace

Incorrect "Unable to start debugging...Unable to attach to ASP.NET worker process" message in Delphi 2007 for .NET

I have seen this for a long time, and finally decided to put the question up here. I have some applications that I need to maintain that were written in Delphi 2007 for .NET (ASP.NET 2.0). Normally, the first time I run the application (using IIS) I get the classic "Unable to start debugging on the web server. Unable to attach to ASP.NET worker process" message. I simply press F9 (run) again, and it runs. Sometimes I have to try running several times before it will actually run.
I am running Windows 7 64-bit (and have seen the same effect on Vista 64-bit). I do have IIS configured for ASP.NET, and I do have the following code in my Web.config file.
<system.webServer>
<modules>
<add name="DbgConnect" type="Borland.DbkAsp.DbkConnModule,Borland.dbkasp,Version=10.5.0.0,
Culture=neutral, PublicKeyToken=b0524c541232aae7" preCondition="managedHandler" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
The point is that I eventually can run the application in the debugger, sometimes even on the first try. Many times when I get the failure it happens about 15 seconds or so after I press Run, sometimes even after I've hit a page or two (or three) of the Web app. And, yes, when Delphi gets into this mode, I can simply run without debugging, and all is fine (unless I really want to debug). And, I can just keep on trying to run in the debugger and eventually it will just work.
It appears that Delphi's .NET debugger is somehow getting the idea that the application cannot run, and then gives up and stops the process (which as I've mentioned is sometimes clearly running).
I know of other developers who have also seen this behavior. My question is, does anyone know how to stop this annoying behavior?
I don't remember the exact error message, but I believe I've seen something at least similar to this in the past. All I did to fix it was run a "Repair" on the .NET 2.0 Framework (through Control Panel --> Add/Remove Programs). Then maybe restart your computer after that...
If you have this problem, you're going to continue to have this problem. However, here is a workaround.
Begin by running your project without debugging, and then attach to it once it is working. To do this, select Run | Run Without Debugging, or press Ctrl-Shift-F9.
Once your application is up and running, and you want to have the services of the debugger available, select Run | Attach to Process. From the Attach to Process dialog box, set the Debugger dropdown to CodeGear .NET Debugger. IIS will now appear in the Running Processes listbox. On my machine, it appears as w3wp.exe. Uncheck the Pause After Attach checkbox, and then click Attach. (After using the Attach to Process dialog box the first time, it will default to the .NET debugger and Pause after attach will not be checked.)
You are now running with the debugger enabled. If you hit a breakpoint, or encounter an exception, or select Run | Program Pause, the debugger will be loaded. If you want to disable the debugger without closing the application, select Run | Detach From Program.
Apparently, since the application is already running, whatever was giving up and giving the false error message is not involved.
On the plus size, there is a nice side effect of using this approach to debugging a Delphi for .NET application. Once you are runninng, and find a problem, you can pop into the debugger and see what's going on inside. If you find a problem to fix, detach from the proces, fix the problem, and re-compile. You can leave your application running in IIS.
Once the project has been re-compiled, the next page you hit in the application using IIS will cause the updated program to load. If you need the debugger again, simply attach to the IIS process. In other words, you an debug, fix, recompile, debug, fix, recompile,... without having to ever close the application in your browser.

Is it possible to debug IIS without affecting all users of the service?

This may seem like a silly question, but we are having an issue debugging IIS in a shared test environment and I'm hoping that someone out there can give us an answer.
We have a Windows Server 2003 that is running IIS 6 and sharepoint 2007. We are debugging locally on the server with visual studio 2008.
When someone attaches the debugger and steps through the code, we find that all users are affected. In essence the web server stops handling all requests from all users.
Our question is whether this is a typical situation and is to be expected? Or is there some configuration that we can change that would allow the one user's session to be debugged but leave the other's unaffected.
Kev's on the right track. You need to make sure that the project you want to debug separate from the others is in its own application pool. This will isolate it to its own process and allow that process to be stopped/debugged without affecting the other applications which can remain in a different pool.
Setup
Start -> Run -> inetmgr
Right Click on Application Pools
Click New -> Application Pool
Name the new pool
Right Click on the application you want to isolate
Click Properties
Click on the Home Directory tab
In the application pool drop-down list select your new pool
Click OK
If there are any requests queued in the old process, they may take a few minutes to terminate before all requests are being diverted to the new process.
Debugging
To figure out which instance of w3wp.exe you need to attach the debugger to:
Start -> Run -> cmd
Type iisapp
You may be prompted to register CScript, if so click yes and run it again
The only gotcha you may still find is that if multiple applications are using the aspnet_state service you may run into blocking issues if you need to debug that process as well.
Links
MSDN
Developer.com
"When someone attaches the debugger
and steps through the code, we find
that all users are affected. In
essence the web server stops handling
all requests from all users."
This is normal, once you attach a debugger to a process such as inetinfo.exe or w3wp.exe and set a break point, every request/thread will be blocked until you allow the debugger to continue, until the next break-point.
I've never found a way around it. Is there some reason you can't debug on each developer's workstation?
Set up a parallel project on the server and try using that. You could use debug.mydomain.com and then just use that for testing. The only reason that I personally can think of to debug on your live servers is if there is a significant difference in the functioning of your app due to either hardware or software configuration.
Ideally you want to have a separate server/instance of your system in as similar an environment as possible so that you don't have to debug on your live machine. Also you might want to consider writing all errors to the event log or at least checking the log since asp.net usually get logged there. This way you can see where your errors are and use that to help you solve your problem in the development environment.
I believe in visual studio you can set the debugger to break only the process being debugged, and not all the processes. Depending on how your system is set up, YMMV with this.
It can't be changed AFAIK. But that's a normal practice to set up separate web-node or web-application for development/debugging purposes. If that's necessary to know exact values of some vars in certain situations you can always use debug logging.

ASP.NET Application Deployment Issue

I have deployed an application written in ASP.NET 2.0 into production and it's experiencing some latency issues. Pages are taking about 4-5 seconds to load. GridView refreshing are taking around the same time to load.
The app runs fine on the develpment box. I did the following investigation on the server
Checked the available memory ... 80% used.
Cheched the processor ... 1%
Checked disk IO from perfmon, less than 15%
The server config is
Windows Server 2003 Sp2
Dual 2.0 GZH
2GB RAM
Running SQL Server 2005 and IIS only
Is there anything else I can troubleshoot? I also checked the event log for errors, it's clean.
EDITED ~ The only difference I just picked up is on the DEV box I am using IE7 and the clients are using IE6 - Could this be an issue?
UPDATE ~ I updated all clients to IE8 and noticed a 30% increase in the performance. I finally found out I left my debug=true in the web.config file. Setting that to flase got the app back to the stable performance... I still can't believe I did that.
First thing I would do is enable tracing. (see: https://web.archive.org/web/20210324184141/http://www.4guysfromrolla.com/webtech/081501-1.shtml)
then add tracing points to your page generation code to give you an idea of how long each part of the page build takes:
System.Diagnostics.Trace.Write(
"Starting Page init",
"TraceCheck");
//Init page
System.Diagnostics.Trace.Write(
"End Page init",
"TraceCheck");
System.Diagnostics.Trace.Write(
"Starting Data Fetch",
"TraceCheck");
//Get Data
System.Diagnostics.Trace.Write(
"End Data Fetch",
"TraceCheck");
etc
this way you can see exactly how long each stage is taking and then target that area.
Double check that you application is not running in debug mode. In your web.config file check that the debug attribute under system.web\compilation is set to false.
Besides making the application run slower and using more system memory you will also experience slow page loading since noting is cached when in debug mode.
Also check your page size. A developer friend of mine once loaded an entire table into viewstate. A 12 megabyte page will slip by when developing on your local machine, but becomes immediately noticeable in production.
Are you running against the same SQL Server as in your tests or a different one?
In order to find out where the time's coming from you could add some trace statements to your page load, and then load the page with tracing turned on. That might help point to the problem.
Also, what are the specs of your development box? The same?
Depending on the version of visual studio you have, Team Developer has a Performance Wizard you might want to investigate.
Also, if you use IE 8, it has a Profiler which will let you see how long the site takes to load in the browser itself. One of the first things to determine is whether the time is client side or server side.
If client side, start looking at what javascript you have and optimize / get rid of it.
If server side, you need to look at all of the performance counters (perfmon). For example, we had an app that crawled on the production servers due to a tremendous amount of JIT going on.
You also need to look at the communication between the web and database server. How long are queries taking? Are the boxes thrashing the disk drives? etc.

Resources