IIS8 Won't update web site - c#

I have a web site being hosted on a Windows Server 2012 using IIS8. I had modified some code and uploaded it to the server and then restarted the website. The problem is, the old code is executing!
I have:
Restarted the IIS Server
Rebooting Windows Server 2012
Disabled Output Caching for the site.
Disabled Output Caching for the entire server
Removed and readded the website.
I even opened the code file in notepad on the server and confirmed that it IS the new code. The old code, to my knowledge, doesn't exist on the server! What am I missing?

You may want to try attaching the visual studio debugger to the instance of IIS and see if you can hit some breakpoints in the old/new code.
To Do this in visual studio.
Click "Debug" from the menu bar
Click "Attach to Process"
Check the "Show processes from all users" checkbox in the bottom left corner
Select aspnet_wp.exe from the process list
Click "Attach"
If the code does not match between the code in visual studio and the code, you will not be able to set a breakpoint. However, if the code is the same, you will be able to attach and breakpoint and follow the flow of the execution.
Also, have you checked if the DLL's are deployed to the GAC (Global Assembly Cache)? If a .dll exists in both locations on the windows box the application will always pull the version that is in the GAC.

Related

visual studio 2010 remote debugging: start external program: directory does not exist

Everything works if I do "Attach To Process".
But I need to debug a problem during launch of an application, so I need to be able to either "Start project" or "Start external program" the remote exe.
When I do, I get "directory does not exist". (Presumably, It is either looking for this non-existent directory LOCALLY, or it lacks permissions.)
Details:
* .Net Framework 3.5; C# Windows Form, with button that when clicked does
Debug.WriteLine("Hello World!");
Two Windows 7 Ultimate PCs, with same username and password, administrator.
Local PC:
Visual Studio 2010 Professional. Hello World project open and built.
Tested locally: Start Debugging / hit button / see "Hello World!" in VS Output pane.
Quit local version of app.
Remote PC:
Visual "Microsoft Visual C++ 2010 SP1 Redistributable" installed (so can run a debug version of this .Net application; before installing said "The program can't start because MSVCR100.dll is missing, when hit a breakpoint.").
Visual Studio Remote Debugging Monitor running.
says "(date/time) Msvsmon started a new server named Steve#FRESHINSTALL: Waiting for new connections".
When Attach to Process, says "FreshInstall\Steve connected".
Copy from local pc's project location (in default VS 2010 projects), \bin\debug* to C:\Code\HelloWorld*
Code folder is Shared with full privileges (just in case ...)
Attach to Process works fine:
click button => "Hello World" -- in Local PC's Output pane, just like when running locally.
Now, the problem. How LAUNCH the .exe remotely, instead of Attach to Process?
On Debug pane:
Tried "Start project"
alternatively, tried "Start external program:" C:\Code\HelloWorld\HelloWorld.exe" -- on Remote PC, this is the path to .exe
Working directory: "C:\Code\HelloWorld" <-- this directory ONLY exists on Remote PC (deliberately -- to make sure we aren't executing locally)
[checkmark] Use remote machine: FRESHINSTALL.
Tried with and without "Enable the Visual Studio hosting process".
When do "Start Debugging", all variations say "The working directory does not exist: "C:\Code\HelloWorld".
Well, of course not: it is on Remote PC, not locally.
Yet everywhere I look, this is what instructions say to do.
What am I supposed to do differently, or what could be wrong?
(Obviously this simple app, I could stick with Attach To Process. But I have a MUCH more complicated multiple-dll application, which is having a problem during startup. I need to breakpoint the "real" application during its start up, not after it is already running.)
(And the real situation I have to debug, is on the other side of the world, with a slow internet link. This is a local simulation of what is going wrong there. Not practical to install visual studio on the actual remote PC, to turn it into a local debugging situation. Spent a day trying to remote debug that; after I get it working on a local network, I have to duplicate the whole process with much less control over what is going on.)
In the interests of closing this question, to indicate that it has been addressed:
See wal's first comment on my question, and follow the link he gave, which I repeat here:
Visual Studio remote upload and debugging on other computer

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
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:
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:
Make code changes
Stop the ASP.Net Development Server
Rebuild the project containing the changes
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.
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

Unable to Start Debugging on the WebServer

While creating the website I choose Location as HTTP and then provided http://172.24.17.188/myProject and it created the project happily.
And I was able to run the project too. But once I have closes the VS2008 and reopened the project , I am getting the following error while trying to run the website.
Edit:
I am able to browse the website by manually typing in browser but unable to run or debug usinh VS2008.
If the website is running on IIS on the same machine then you can attach the debugger to the IIS process. You do this by click on "Debug" then "Attach to process...". Sort the processes in descending order and find the process named "w3wp.exe". Then click the "Attach" button. If you don't see the process then view the site in a browser to allow IIS to start the process.
If the website is running on a different server then you can do the same but you need to run the remote debugging tool (MSVSMON). This means you will need to have Visual Studio installed on the webserver. Run MSVSMON and be sure the firewall doesn't block the connection. Now you click "Debug" then "Attach to process...". Enter the server name that was displaed on MSMON's debug window in the qualifier textbox. If everything is setup properly you will see the remote servers process list. Then you can connect to the "w3wp.exe" process.
These are two ways to debug web applications using Visual Studios and IIS.
Do the following changes in your IIS settings
Make sure that IIS is configured to use Integrated Windows Authentication
Make sure that HTTP Keep Alives are enabled.

Visual Studio 2010 is not allowing me to debug my code

So, this interesting issue has been plaguing me for the past couple of hours. Visual Studio 2010 Ultimate no longer attaches the debugger and lets me debug my code.
If I use the built in development server, then everything works fine. If I switch to Use Local IIS Web Server (http://localhost/), then all it does it attach to w3wp.exe, but no DLLs or PDBs are loaded for anything. I can go to Debug > Windows > Modules, and literally nothing is loaded in this window. Conversely, when using the built in development server, the Modules window displays all the DLLs and shows that the symbols for my DLLs have been loaded. Something is obviously amiss. The VS installation is completely bone stock.
In IIS, my website is configured with ASP.NET 2.0 (because no 3.5 exists to select from the drop down), along with read / log visits / index this resource options checked on the "Home Directory" tab.
Some of my failed ideas:
1) If I attach to process on the iexplore.exe instance where the website is displayed, it loads Internet Explorer's DLLs, but not mine.
2) I've restarted the computer multiple times
3) I've invoked devenv.exe /resetuserdata once
4) I've confirmed that every project is indeed set to debug and not release.
5) Deleted all \bin contents and rebuilt the solution.
6) Deleted entire solution and repulled from Source Control.
Can someone tell me what is wrong with this thing? I'm going to have an aneurism from the headache this is causing me.
You need to attach it to the IIS worker process, which OS are you using? Make sure you attach with the Managed + Native flags, in the Attach to Process. What happens if you just run (F5) your web application inside Visual Studio (that automatically attaches a debugger)? Do you get any errors?
Well there are quite a few good answers here, but I have found that the root cause of the issue for me was application pool authentication configuration. Let me lay out the scenario that I experienced and the solution and perhaps it will help someone save time....and hair.
Scenario:
I want to debug an ASP.NET web application in Visual Studio 2010 but cannot use the built-in Visual Studio web server. The reason that I could not use the built-in web server is that my application referenced assemblies built specifically for a 64-bit architecture and the VS web server would not support these. So, I had to use the option "Use Custom Web Server" in the website properties to point the debugger at a published instance of my site on a remote IIS web server.
Issue:
Even with the web.config debug options set correctly to publish debug symbols in the assembly output (i.e. compilation debug="true"), the debugger would not attach to the remote IIS process and I did not hit any breakpoints
Environment:
The Visual Studio 2010 debugger was already installed on the remote IIS web server and was running as a Windows service under the LocalSystem account.
Solution:
Enable "Anonymous Authentication" in addition to "Windows Authentication" on the web site hosted on the IIS web server.
As soon as I enabled anonymous authentication, the correct symbols were loaded by the VS remote debugger and I was able to hit the breakpoints.
Hope this helps you guys out.
Have you tried deleting the browser cache? Sometimes the browser hangs on to old code which is incompatible with the current build and thereby prevents debugging.
Does it run the app - without the debugger attached? It smells like you are attaching the debugger to a wrong process
I've had an issue before where under the build configuration screen some projects are unticked for a particular solution configuration, causing them to not build and therefore not be debuggable. Can you confirm whether or not code changes you make are actually being built and executed?
Also, what version of Windows and IIS are you running? Is it possible that your process is running under an AppPool with an account that's different to the account you're logged in with and perhaps it's a permissions problem? If it's Vista/Win7, is UAC turned on and are you running VS as administrator? I'll also second the suggestion to try a fresh project and see what that does. Are you in the debugger users local group on the machine?

Attach Debugger to IIS instance

I have IIS 5.1 on a XP machine, and visual studio 2005. How do I go about attaching my debugger to IIS instance.
BTW: I'm not seeing the IIS process within the running processes or probably I don't know what to look for .
In Visual Studio:
Click "Debug" from the menu bar
Click "Attach to Process"
Check the "Show processes from all users" checkbox in the bottom left corner
Select aspnet_wp.exe, w3p.exe, or w3wp.exe from the process list
Click "Attach"
Just to clarify Jimmie R. Houts answer…
If you want to debug the web application VS and IIS you can do the following:
Host the site inside IIS (virtual directory etc).
Then in VS2005 do this:
Right Click on Web Project → Properties →
Start options → Use Custom Server → Base URL → Enter Site Address as
Hosted in IIS.
Hit F5 and you will be able to Debug your code
Same works for VS 2008 also.
I'm running Windows 7 with IIS Version 7.5 and I also needed to tick the "Show processes from all users" and "Show processes in all sessions" boxes - at the bottom of the "Attach to Process" dialog.
Also I had put my app in a specific App Pool which means you can then see it labeled against the w3wp.exe.
The possible names of the ASP.NET process:
w3wp.exe is IIS 6.0 and later.
aspnet_wp.exe is earlier versions of IIS.
iisexpress.exe is IISExpress.
dotnet.exe is ASP.NET Core.
inetinfo.exe is older ASP applications running in-process.
From Find the name of the ASP.NET process
The IIS process is aspnet_wp.exe.
In fact, attaching to the aspnet_wp.exe process is what VS does when you have your project set to use IIS for debugging.
You'll also need to open Internet Information Service From Control Panel > Administrative Tools. Right click the web site in question, click the home directory tab, and select the configuration button. This will open a new form with three tabs - click the debugging one and select the two options in the debugging flag section. This is also necessary to debug.
Using an Attach to IIS plugin (VS2015, VS2017) plugin saves a few clicks - especially when dealing with an ecosystem of IIS hosted sites (one frontend with multiple backend services say)
If you see the process [e.g. IIS Worker Process (w3wp.exe)] running is Task Manager, but not in the list of processes in debug > attach to process, you might need to run Visual Studio as administrator.

Categories

Resources