Resetting IIS Express at runtime - iis-express

I have some tests that require me to restart IIS before running them. With full-blown IIS, this is as easy as running iisreset from Process.start.
The problem I have now is one of my computers is on hoary old Windows XP, so it doesn't support IIS7. I installed IIS Express, but I can't seem to figure out a way to restart IIS Express (or restart a single website) through the command line or through some sort of services.
Some questions on SO and elsewhere suggest restarting the MsDevSvc service, but this doesn't seem to be related to IIS Express.
Edit: This solution looks promising: https://stackoverflow.com/a/4777927/210780

Related

Chrome/Windows: Connection refused when I use my IP address

I have an ASP.NET server running under VS2010 on my PC (Win7) on port 12345.
When I load localhost:12345 in Chrome, my default page loads perfectly.
But when I load 192.168.128.104:12345 (by my internal IP, not by localhost) I get "connection refused".
Exact same behavior when I try to access the server from another device on my intranet (in my case, a Raspberry Pi)
I realize that when I hit localhost that I'm just looping back in my adapter, thus the request never leaves my machine. So it would seem that the cause is due to the request leaving & re-entering my machine.
I've create custom Inbound & Outbound rules in my Windows Firewall to allow port 12345, but to no avail.
Any ideas would be appreciated.
I found the answer here:
Can I access ASP.NET Development server in an intranet?
which led me to this:
http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/UseFiddlerAsReverseProxy
As is so often the case, finding the answer is hugely dependent upon using the correct search terms. Here the critical keywords were "asp.net debug intranet"
The 'right way' here is to use IIS Express and you don't need fiddler to act as a reverse proxy. Its a hack that was used to work around using Cassini - a low budge web server that is outdated (and doesn't compare to IIS Express) and used with VS2010 prior to SP1.
In VS2010 SP1, IIS Express support was added. You can read about that here:
http://blogs.msdn.com/b/webdev/archive/2011/03/14/enabling-iis-express-support-in-vs-2010-sp1.aspx
IIS Express can handle this just fine - and Visual Studio 2010 integrates with it. Its not one or the other - you develop with Visual Studio and when you launch your app it launches it with 2010.
If you want something really easy, install Visual Studio 2015 Community Edition, use ASP.NET 5 (now called ASP.NET Core 1) and simply run it to self host via the play button looking drop down you are used to seeing in VS 2010- no web server required.
Again - being that its 2016 - what you cited is a very old way. If its a quick hack, I can understand that - but if you are looking for the best practice way going forward, use IIS Express (and ideally a newer version of Visual Studio - we have them for free in the 2013/2015 Community Editions)
Hope that helps!

for IIS, should i use Win7 or Server 2012r2?

Ill need to set up a test IIS.
From a rapid research, ive found that Win7 and Server 2012r2 are pretty much offering the same (for IIS purposes).
Major difference is supported RAM and parallel RDP sessions.
Rather than that, relying on the fact i need IIS, which one is the right OS ?
Many thanks !
Not really the same at all. Windows 7 uses IIS 7, whereas Windows Server 2012, uses IIS 8. Plus, Windows 7/Windows 8 are consumer class OSes. They're not intended for running things like web servers. Likewise, Windows Server 2012 is kind of inappropriate as something like a development machine.
If you're talking about "test" in the sense of QA/staging server, then you should use an actual server class version of Windows. If you're talking about a machine to do development on, then you can stick with something like Windows 7 or 8, but then, you shouldn't even be worry about IIS. You'd just have Visual Studio and run everything through IIS Express.

Cannot debug MVC project due to IIS change(8=>7.5) on VS2012 RC

I have installed web matrix and It has somehow removed the existing IIS Express 8.0, that is installed by default during the VS2012RC installation. I think that is because the web Matrix is using IIS 7.5. So that it has replaced the IIS Express 8 with IIS Express 7.5.
So my tech lead told me to remove the existing IIS 7.5 that has been installed during the installation of Web Matrix, And I removed it. So I have no IIS for debugging. So once I tried to install the IIS 8 manually and it says that there is a existing version of IIS Express 8. So that I can not even install the IIS Express 8.
So I did a repair to my VS2012RC. After a lengthy process it finally gave me a report as
"IIS 8.0 Express
Package failed"
So, Now I am totally stuck with this. Can some one good at this VS stuff help me on this issue.
Another thing is, previously when I open the project and it was not loaded(It says the project is not loaded) So, then when I write click on it and do a reload it said "For debugging you have to have IIS 8.0 and ask me to download it and install ".
When I click next and then it goes to "MS web platform Installer" and direct me to the "IIS 7.5 download page" But the install button was enabled and says its installed. What should I do to overcome this issue. This is like a nightmare.
I also Tried to use "Fix it" and Its beta testing is over and I can not do a proper uninstall of the IIS 8, which says that is still existing.
Thank you.
So, what I did was using MS web platform Installer my option of IIS Express 7.5 and IIS Express 8.0 was gone due to a registry issue. But there was another IIS 8.0 which is compatible with Windows XP and Vista and upper. So I downloaded it installed. It installed in no time and then I opened the project and changed my solution configuration, single start up to my website project. And it worked. That saved me form the havoc that day.
Later I uninstalled the IIS 8.0(Xp compatible) and then did a repair again to my VS 2012 and it installed correctly that time. Then I changed the configuration as said above and done.
If you have the same kind of problem you have to check the configuration also. Since I forgot that this took even longer instead of repairing time for the VS 2012 as well as the system restore.

Visual Studio 2010 nasty caching Cassini? Must manually stop service

I've spent waaaay too much time trying to figure this out. I'm running Windows 7 and Visual Studio 2010 in a VMware Fusion virtual.
When I debug my website project, Cassini (aka ASP.NET Web Development Server) starts and the site shows in my default browser (IE). I stop the debugger, make some tweaks to my C# code, and start the debugger again. The website starts up in IE and the site displays, but its using the code base from when I initially debugged NOT including any tweaks in code between the initial debug/build and subsequent debugs/builds.
The only way I can get code changes to build and run in the browser properly is if I manually stop the ASP.Net Web Development Server from the tray and then run debug.
Has anyone encountered this? Not sure if its caused by VS2010 or the environment being a virtual on a Mac.
Manually stopping Cassini after every debug is really starting to suck.
Thanks.
Check if Visual Studio is set to recompile the projects when there are changes.
Check that Tools > Options > Projects and solutions > Build and run > On run, when projects are out of date is set to Always build.
Perhaps you will have a more pleasant experience with IIS 7.5 Express as a replacement for Cassini.
From that page:
IIS Express is a lightweight,
self-contained version of IIS
optimized for developers. IIS Express
makes it easy to use the most current
version of IIS to develop and test
websites. It has all the core
capabilities of IIS 7 as well as
additional features designed to ease
-- website development including:
-- It doesn't run as a service or
require administrator user rights to
perform most tasks.
-- IIS Express works well with ASP.NET and PHP applications.
-- Multiple users of IIS Express can work independently on the same
computer.
Here's an article to help you get started.
Figured this out. I had mapped my Visual Studio 2010 folders to a VMware Fusion share in order to make my .NET projects accessible from Mac world (for copying graphics files into the projects, etc.). Evidently there was some type of permission issue or something that did not result in any sort of alert that was causing the problem.
I remapped all VS folders (Project, Website, etc.) into the standard Documents folder of my user instance and everything began working as expected.
Thanks for the help.

Cannot start debugger on Visual Studio 2010 (F5) However, ' attach to process' does work (slow). How to fix?

The environment:
Clean (new) install of Windows 7 64bit.
Clean (new) install of Visual Studio 2010 Professional (10.0.30319.1).
Windows Update is up to date.
The problem:
I cannot start the debugger on Visual Studio 2010 (hit F5): 'Unable to start debugging on the web server. Unable to connect to the web server. Verify that the web server is running and that incomming HTTP requests are not blocked by a firewall.'
However, 'attach to process' (what I usually do) does work, but it is painfully slow to start (Visual Studio 'thinks' a lot of time before the debugging is actually enabled).
On the same hardware, running VS 2008 on good old Windows XP (32bits), this problem never happened.
Trying to debug a site running under the ASP.NET Development Server also fails: 'Unable to connect to ASP.NET Development Server.'.
There are plenty of web pages about these errors (many very outdated and does not apply to my environment), none of them worked for me.
Notes:
No matter if I run Visual Studio as Administrator or not. The problem is
the same.
The problem happens even when running a brand new blank IIS web site, either created as 'localhost/something' or 'sample.local'.
If I create a 'File System' web site (to try ASP.NET Development Server), when I hit F5, the server starts, but after a long wait Visual Studio says 'Unable to connect to ASP.NET Development Server.'
The 'hosts' file has an explicit 127.0.0.1 entry for 'localhost' and for 'sample.local'
It's the same problem either running .NET 2.0 or 4.0.
It's the same either configuring the application pool with or without 'Enable 32-Bit Applications' true or false.
It's the same either configuring the application pool is classic or integrated mode.
In a desperate attempt, I've added all the IIS 6.0 legacy 'features' stuff (not needed!) and doesn't helped at all.
I don't now what else I can try.
Thanks.
OMG!, I'm so stupid. The most oblivious thing was truly wrong. There was a wrong rule in the firewall. Therefore, even being in 'interactive mode' (as it is was always set), the connection was denied.

Resources