views:

183

answers:

2

I'm using Visual Studio 2005 on a Windows XP SP3 machine and recently have come accross a some what strange issue.

I have a C# and ASP.NET project that runs fine when on the team test server and using IIS locally on my own machine. However, running it using the in-built Visual Studio ASP.NET Development server it doesn't seem to serve all the images/scripts/css files all of the time. When I load a page one time images A, B and C will be missing and I may get a system (sub-package) error however loading it again all those images will be there and the sub-package will work but a CSS, a script or any other image file may be missing.

The Windows event application log seems to show occasionally the missing files will be logged but this isn't consistent either.

+3  A: 

It happens to me all the time; I think the reason is that the ASP.NET Develoment server is not a very good HTTP server, and when receiveing too many requests, it drops some ones.

Since it is also very very slow, I configured vs2008 (you can do that with vs2005, of course) to use ASP.NET for debugging; it works far better that way.

To do that:

Project -> properties -> Web (last tab) -> Server. There are three alternatives: Use Visual Studio Development Server; Use local Web IIS; Use custom Web server. Choose the second. (not sure about the exact english names: I have the Italian version of VS).

giorgian
You mean IIS for debugging? Of course the local dev server is weak.
StingyJack
How do you mean? Running on the local IIS means that if I change/add C# parts I can no-longer debug it (at run-time) as it obviously isn't hooked into Visual Studio.
tgandrews
You will be able to debug (breakpoints, run step-by-step and so on); I edited to explain how to do it.
giorgian
That is true, I use IIS on my machine instead of development server and it works well.
Cleiton
Thanks giorgian it worked. The options weren't there in VS2005 but I found the equivalent setting:Website -> Start Options -> Use Customer Server. You then set it to where your IIS working version is e.g. http://localhost/myproject. I had to enable Windows Authentication in the IIS location to allow VS to start up and debug on the server.
tgandrews
A: 

Check the page in Firefox/Firebug or with IE8 and see if the paths to the files/scripts/images is correct or not. A common problem when switching between the local dev webserver and IIS hosted pages is that the paths may not resolve the same. You can fix this sometimes by using the "~" character before a path in the asp code.

StingyJack
It is exactly the same project code and everything so the images are all there sat in the right place and the paths are correct it just doesn't seem to load them for whatever reason.
tgandrews
They may be in the same locations in the project, but the webservers serve them differently. IIS from a virtual, local dev from root. This causes issues with pathing some times.
StingyJack