user1270384
user1270384

Reputation: 721

Visual Studio 2010 Build issues

I am using visual studio 2010 on .net4.0 for my projects and I've found that each time I do a change in my project, I build and run but I cannot see my changes. I've found this happening once or twice mostly with my web service projects. I'm no pro with web services and am encountering this problem for the first time so would be grateful to anybody who can tell me what has gone wrong with my project and how to fix it. Edit My asmx file is where I have added an additional method but am not able to see it when I run F5

Upvotes: 1

Views: 157

Answers (2)

Igby Largeman
Igby Largeman

Reputation: 16747

When you change the compiled code in a web service or site, you need to make sure you restart the web server hosting that service or site.

You are probably using the ASP.Net Development Server. Although Visual Studio starts this server for you, it does not restart it automatically when you rebuild. As a result, the server will still be referencing the previous version of the assembly that you changed.

In the Windows system tray you should see one or more icons depicting a web page with a purple gear overlapping it at the bottom-left.

There are three of them in this example:

enter image description here

You can stop the server by right-clicking its icon and selecting "Stop". (If you have more than one, you will learn to identify the one you need to stop by recognizing the port number shown in the tooltip when you hover the mouse over the icon.) Visual Studio will restart it when needed.

When you're making changes to a service or site, use this workflow:

  1. Make code changes
  2. Stop the ASP.Net Development Server
  3. Rebuild the project containing the changes
  4. Run

Client-side code vs. Server-side code

If you're changing client-side code (HTML or JavaScript), then you may need to force your web browser to refresh its cache. In Windows this is normally done by pressing CTRL+F5 in the browser (see refreshyourcache.com/en/cache for more info). If you're changing compiled code (C#), and restarting the server doesn't help, try restarting Visual Studio, then do Build -> Clean Solution, then Rebuild.

Upvotes: 4

Ashish Gupta
Ashish Gupta

Reputation: 15139

If you are facing issues in ASP.Net Development Server, I think you are better off creating a virtual directory in IIS and host your web service there. That way you should be able to make your changes, just build it (don't run it) and that should be available on your virtual directory and you just browse to webservice. Then you don't have to hit F5 again and again and don't have to worry about instances of ASP.NET dev server.

Following article contains good step-by-step instructions on how you do it on IIS 7.0. This article is about hosting a website - however, hosting a webservice is not different.

http://www.codeproject.com/Articles/28693/Deploying-ASP-NET-Websites-on-IIS-7-0

Upvotes: 1

Related Questions