What is to prevent me from using IIS Express exclusively on my development box? - asp.net

I have only read a bit about IIS Express, and am in the process of downloading and installing it now. It seems like i should be able to uninstall IIS proper and just make use of IIS Express when developing/debugging webserver-based technologies in visual studio (2010 SP1).
Is this a sane conclusion?
What development scenarios might not play well with IIS Express?
Are there cases wherein IIS proper would absolutely still be needed?
My use of IIS in the past has been for ASP.NET MVC cases, a few web service debugging sessions, etc. Obviously IIS proper is still needed for actually hosting the resulting solutions, but can i realistically "free up resources" and just use IIS Express on demand?

To my knowledge some known issues with IIS Express:
Only http/https protocols are supported
There is limited UI support (through Visual Studio and WebMatrix) to configure IIS Express. But you can configure it manually by editing applicationhost.config.
IIS Express runs as current logged on user, so you may run into issues like http://forums.iis.net/t/1175734.aspx
It will be slow because by default failed request tracing and console tracing are enabled (failed request tracing can be disabled by editing applicationhost.config file)
Kernel mode caching is not supported

Related

What is Kestrel (vs IIS / Express)

What is the kestrel web server and how does it relate to IIS / IIS Express?
I come from developing apps on IIS Express and hosting them on an IIS web server. With ASP.NET Core I have a dependency on Microsoft.AspNetCore.Server.Kestrel and my startup has .UseServer("Microsoft.AspNetCore.Server.Kestrel"). But when I run my website, I still get the IIS Express icon in the system tray. Someone asked me if I was using IIS Express or Kestrel and I didn't know what to say!
I don't have any cross-platform requirements as I develop on a PC and host in Azure, so I'm confused if I even need Kestrel, but it doesn't seem like there's an alternative - even the simplest samples use Kestrel.
I'd like to offer an alternative answer, with some history, so that you might understand why Kestrel comes, even if you only use Windows and IIS.
At the very beginning of ASP.NET development before year 2000, clearly Microsoft created two pieces to host ASP.NET WebForms apps,
Cassini, later became ASP.NET Development Server in Visual Studio. It is a fully managed web server written in C# based on HttpListener. Of course, since it was for development only, many features were never implemented. As Microsoft made the source code of Cassini available for the public, there are third parties who forked the code base and added more features, which started the Cassini family.
ASP.NET support on IIS (revision 1). Because IIS was 4.0 and 5.0/5.1 at that time, which has nothing like application pools, ASP.NET even has its own worker process (aspnet_wp.exe).
So to develop a web app, you use Cassini, and to deploy you use IIS.
The introduction of application pools in IIS 6 required some changes on ASP.NET side, so aspnet_wp.exe became obsolete and replaced by aspnet_isapi.dll. That can be seen as ASP.NET support on IIS revision 2. So ASP.NET apps are being hosted in IIS worker processes w3wp.exe.
The introduction of integrated pipeline in IIS 7 and above required further changes, which replaced aspnet_isapi.dll with webengine4.dll. That can be seen as ASP.NET support on IIS revision 3. ASP.NET and IIS pipelines are unified.
You can see ASP.NET has become much more complex and tightly integrated with IIS, so Cassini started to show its age, and gradually was replaced by IIS Express (a user mode lite IIS).
Thus, in many cases, when people blame that IIS is slow, they should blame ASP.NET in fact. IIS itself without ASP.NET is pretty fast and stable, while ASP.NET was not developed with enough performance metrics in mind (as WebForms focuses quite a lot of productivities and RAD).
Then in November 2014, ASP.NET 5 (later renamed to ASP.NET Core) was announced and became a cross platform technology. Obviously Microsoft needed a new design to support Windows, macOS, and Linux, where all major web servers, nginx/Apache (or other web servers) should be considered besides IIS.
I think many would agree that Microsoft learned quite a lot from NodeJS, and then designed and developed Kestrel (based on libuv initially but might move to other technology soon). It is a light-weight web server like Cassini initially, but later more features are being added (like another answer commented, much more features so can be treated as a full web server). Though fully managed (some native dependencies exist), it is no longer a toy web server like Cassini.
Then why cannot you just use Kestrel? Why IIS Express and potentially IIS, nginx, or Apache are still needed? That primarily is a result of today's internet practice. Most web sites use reverse proxies to take requests from your web browsers and then forward to the application servers in the background.
IIS Express/IIS/nginx/Apache are the reverse proxy servers
Kestrel/NodeJS/Tomcat and so on are the application servers
Another answer already showed a link to Microsoft documentation, so you can take a look.
Microsoft developed HttpPlatformHandler initially to make IIS a good enough reverse proxy for Java/Python and so on, so planned to use it for ASP.NET Core. Issues started to appear during development, so later Microsoft made ASP.NET Core Module specifically for ASP.NET Core. That's ASP.NET support on IIS revision 4.
Starting from ASP.NET Core 2.2, ASP.NET Core Module for IIS (version 2) can host .NET Core environment inside IIS worker process (w3wp.exe), quite similar to ASP.NET 2.x/4.x. This mode is called "IIS in-process hosting". It can be considered as ASP.NET support on IIS revision 5.
Well, quite lengthy, but I hope I put all necessary pieces together and you enjoy reading it.
One recent update (Jan 2023) is that ASP.NET Core/Kestrel can be used to host reverse proxy functionalities itself, as the open source YARP project revealed.
Kestrel/YARP is now widely used inside Microsoft Azure to replace IIS ARR in many scenarios as reported, so literally now you can host your own production web apps with Kestrel/YARP without any other web server (IIS/nginx/Apache) in front as well.
What is Kestrel
It's a full blown web server. You can run your ASP.NET Core application using just Kestrel.
But when I run my website, I still get the IIS Express icon in the system tray
In your ASP.NET application, probably in the wwwroot directory, you'll see a web.config that contains this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/>
</system.webServer>
</configuration>
This is the HttpPlatformHandler. Essentially, what this does is forward all requests to Kestrel. IIS Express (and IIS for that matter) will not run ASP.NET themselves anymore. Instead, they will act as proxies that simply pass requests and responses back and forth from Kestrel. There is still advantages of using IIS, specifically it gives you security configuration, kernel-level caching, etc.
From ms docs at:
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?tabs=aspnetcore2x
Kestrel is a cross-platform web server for ASP.NET Core based on
libuv, a cross-platform asynchronous I/O library. Kestrel is the web
server that is included by default in ASP.NET Core project templates.
You can use Kestrel by itself or with a reverse proxy server, such as
IIS, Nginx, or Apache. A reverse proxy server receives HTTP requests
from the Internet and forwards them to Kestrel after some preliminary
handling.
UPDATE: .net core 2.1, Kestrel uses managed sockets instead of libuv
From asp.net core 2.1 docs at: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-2.1#transport-configuration
With the release of ASP.NET Core 2.1, Kestrel's default transport is
no longer based on Libuv but instead based on managed sockets.
Multiple apps on the same port is not supported in Kestrel.
Windows Authentication does not exist on Kestrel.
Request Filtering is much more fully featured in IIS.
Mime Type Mapping is much better in IIS.
HTTP access logs aren’t collected in Kestrel.

Debugging an ASP.NET application on Local IIS Server

I have setup a local IIS instance to run and development an older ASP.NET (CLR v4.0) application that I have inherited.
I am running it an a virtual directory, and I am able to attach to the IIS process and debug it (annoying). However, I am unable to "F5" in Visual Studio to start debugging. I get an error message saying "The web server could not find the requested resource."
I have went through all of the Microsoft advice on their help page without much luck. Am I naive in thinking that this will work, or am I missing something? I even installed the IIS 6 Metabase compatibility, but that did not seem to help either.
I realize that I probably need to give more information, but I don't know what other details I need to add.
This is running on Windows 8.1 Enterprise with IIS 8, and I am using Visual Studio Professional.
Thanks
MYSTERY SOLVED!!!!!!!!!
Apparently, Request filtering is installed by default. In order for debugging to work, you have to go the virtual directory -> Request filtering -> Http Verbs, and allow verb DEBUG.

404 error when accessing WCF Rest service hosted in ASP.net on Windows Server 2008

I have a WCF Rest Server hosted in an ASP.net Application. It was set up using the simple RouteTable setup in global.asax. ON my development machine with IIS 7, it works perfectly, but when I deployed to A windows Server 2008 machine with similar IIS settings, it does not work, I get a 404 error when my ajax methods tries to access the service. I was wondering if WCF is able to be hosted like I have on my development machine on an actual production server? If so what must I do to get it to work.
turns out from careful googling it turned out to be a missing attribute on system.webserver modules section: runAllManagedModulesForAllRequests="true"
Source:
http://www.west-wind.com/weblog/posts/2011/Mar/27/ASPNET-Routing-not-working-on-IIS-70
In my case, it was even more simple!
The symptom was that all POST requests returned 404s.
I'd only just enabled IIS (via Programs and Features -> Turn Windows features on and off) on a new Dev machine that already had Visual Studio fully installed.
I had to enable .NET 4.5 for IIS (via C:\\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i) and then all was well.
It's confusing, because I had already set the IIS App Pool to run under .NET Framework v4.0.30319. There was no warning that I had to separately run regiis.

What is the difference between IIS server and development server provided by Visual studio?

Can anyone please tell me the difference between IIS Server and Development server provided by Visual Studio.
Here is a few links to read up on :-)
Core Differences Between IIS and the ASP.NET Development Server
ASP.NET Development Server or Localhost IIS?
What are the (dis)advantages of using Cassini instead of IIS?
I don't know why your looking into this but you might want to take a look at IIS Express - Introducing IIS Express
There are MANY differences, some of them:
Local access in Cassini
Cassini does not support S
Cassini runs as your account (whoever is logged on), IIS runs as a service which means some things change quite a bit
Does not support authentication methods like Basic, Digest, etc.
Does not run any of the IIS Modules, which means you will not be able to do things like URL Rewrite, Default Documents, Directory Browsing, Custom Errors for static pages, etc
Does not support things like Virtual Directories, etc.
What I would recommend for anyone wanting something as simple as Cassini, yet more compatible is to use IIS Express which supports almost all features from IIS yet with a much simplified model suited for development http://weblogs.asp.net/scottgu/archive/2010/06/28/introducing-iis-express.aspx. Visual Studio will include support for it.

Why is IIS not serving aspx pages?

I'm deploying an ASP.NET application to Windows Server 2003 under IIS
IIS is serving html pages fine but I get a page not found when I try and serve IIS pages
You may need to "register" IIS for ASP.NET applications. As an administrator, run the command "%systemroot%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -i". In addition, you may need to convert your web site to an application through the IIS management console.
By default, IIS has ASP support disabled in IIS6.
A server running a member of the Microsoft® Windows® Server 2003 family supports application server functionality, with Microsoft ASP.NET as an option that you can enable when configuring the application server role. To deploy ASP.NET Web applications to a production server, you must be sure to enable the ASP.NET and Internet Information Services (IIS) roles on the production server before you distribute the application.
See here for instructions to enable it:
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/9fc367dd-5830-4ba3-a3c9-f84aa08edffa.mspx?mfr=true
Other possible reason could be Web Service Extensions, where ASP.NET version could have been disabled. My other post here explains steps to solve this.
Make sure the right .NET framework is installed properly
Make sure the ASP.NET extension is enabled
Under website properties, ASP.NET tab, make sure the right version is set.
After having this same issue and trying all of the above without any luck. We reinstalled SP2 for Windows 2003 and this resolved our issue. I too have seen this problem resolved a few times with the other answers. Most of the time just reinstalling .Net 2.0 resolves the issue but not this time.
For future reference, this could also be the issue:
IIS on a Windows Server 64-bit can only to run in either 32 or 64 bit mode.
In short you need to:
1) run adsutil.vbs to enable 32 bit asp.net apps on win 64
2) re-register IIS calling aspnet_regiis.exe
3) re-open IIS Manager, go into Web service extension list and ensure ASP.Net version {2/4.xxx} (32-bit) is set to Allowed
(You might need to do Steps 2 and 3 for both Framework 2.0 and 4.0 if you want to run asp.net apps on both versions)
Full details are in the following link: http://support.microsoft.com/kb/894435
Another future reference in case this is helpful to anyone who used a similar path to mine.
My back end for the ASP.NET app was MySql not Sql Server, which for me meant having a mysql connector, the reason my IIS was not serving the .aspx file is because on my development environment I was using a different version of the MySql connector than the one installed on my production environment, I updated the MySql connector on the production server to match the version Im using on the development environment and it worked great.

Resources