Using XSockets.NET in MVC 4 project. Project deploying on IIS 7.0 - asp.net

For now I'm just have a little experience in web development. So, cannot be sure in second decision.
I'm restricted by .NET 4.0, ASP.NET MVC4 and IIS 7.0 for application deploying.
Can i include to my MVC project XSockets.NET library?
Disturbs note on the main page Note: We do not recommend to host XSockets inside of IIS in test/production due to the fact that IIS recycles. Which version Windows Server i restricted also ?

As per Uffe's First comment.
If you do not use state in XSockets you do not need to worry about
the IIS recycle. Just use XSockets inside of IIS and rock on. If you
use state in XSockets I would recommend you to use the windows
service, azure, amazon, console app etc...

Related

Why shouldn't I use IIS Express for ASP.Net Core development?

It seems that .net core needs to be published to run on IIS which means it's either impossible or impractical to debug through IIS, but it's fine with IIS Express. My more experienced colleagues insist that we should do all development with IIS and never IIS Express which is, in effect, saying we should not touch .Net Core.
1) How likely am I to find that the app which works on IIS Express doesn't work on IIS?
2) What's the best way to mitigate the downsides?
3) What should I tell my boss? (I really want to keep working with core)
There is no reason not to debug using IIS Express. You can verify that your deployment works on IIS by publishing to a staging environment or even a local IIS instance.
That being said, it is possible to debug IIS locally by using Attach to Process in Visual Studio if your coworkers simply refuse to use IIS Express.
Its a big difference between iis express and iis(server). on iis server you need to configure first the iis itself. register asp.net, set up .net framework,set up config file and so on..
But this would be a good practice for the developer, iis server deployment process. is a must.
Hope it helps your idea..
When working with ASP.NET Core & Visual Studio IDE, its better to use IIS Express (kestrel internally) for following reasons
Kestrel is a light weight web server built for ASP.NET Core apps. IIS Express will make use of it while development & debugging.
Hosting IIS for ASP.NET Core apps is for providing load balancing, SSL, gzip etc. So even if you host on IIS, then its fine but development experience will be less productive.
ASP.NET Core apps are cross platform so you can work on Windows, Linux & MacOS. With IIS your are limiting to Windows only
Core apps are not like traditional ASP.NET MVC 5 or Web form apps. They have being made easy for development experience.
I would suggest that think of IIS only during deploying Core apps for QA, UAT or PROD. For development need not host on IIS. Hope this helps

Use full IIS during ASP.NET 5 / Core 1.0 development

I used to develop my web-apps using ASP.NET 4.x and host them in full IIS already during development, because:
1) I use multi-tenancy (site1.me.local and site2.me.local point to my app) and IIS express can't handle that AFAIK
2) Most of the times I do not need a debugger -> I just (re)build my app and refresh the browser - restarting IIS Express and the VS debugger wastes some time
Now I tried my first web-app using ASP.NET 5 aka Core 1.0 and I wasn't able to get it to run in full IIS to continue using my known workflow. I found out I can start IIS Express without debugging and just rebuild to solve #2, but #1 is still open.
Is full IIS even supported for ASP.NET 5 / Core 1.0 during development? If so is there some documentation on how to set that up around?
All documentation for full IIS I found is for publishing, but not for development.
You may actually not event want to use IIS in development with Asp.Net Core. Asp.Net Core has been separated from IIS and even in production IIS will only act as a reverse proxy passing requests to your AspNet.Core application. Asp.Net Core uses Kestrel as an application server and it is much easier to use just this during development. To get a similar workflow you had before you would use dnx watch/dotnet watch during development which will watch code files of your application and if any of the files changes it will stop the application, rebuild the project and restart the application. This is when you can refresh the browser to see changes (note that this is even one less step that you had before where you had to rebuild the application yourself).
It still should be possible to use IIS for development if you really need it but if you don't have a specific scenario that requires IIS I don't think IIS for development will give you any benefits.
The integration mode with full IIS has been changed several times (from Beta to RC1 and now to RC2), which messes up the documentation,
https://github.com/aspnet/Announcements/issues/164
You probably need to wait till RC2 is available to see the latest official steps.

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.

How to route request from one application pool to another in iis 6.0

I have got two web applications (separate virtual directories) residing in the DefaultAppPool on Windows Server 2003. My first application has got a link and when I click on it, the second application opens up.
Now I want to use different .Net framework for both web applications and for that in IIS 6.0, I will have to host them in separate app pools.
Now the question is - is it possible to host them in different app pools and keep the behavior intact so that if I click on the link in first web application, it can still open the second web application hosted in a different app pool?
Thanks in advance,
D
I think I've found the solution and it is simpler than what I actually thought.
Steps I took:
Create another app pool in IIS 6.0 on Windows Server 2003
Assign one of the web applications to this pool. So now I have two web applications in two different app pools. Currently both are having ASP.NET version as 2.0.50727
Change the ASP.NET version of one of the applications to 4.0.30319. So interesting fact to understand here is - in IIS 6, you can't set the .NET framework for an app pool. It actually assumes it from the first application in it and then applies it to all the web applications residing in this app pool
And it is done!!
It can be checked to list all the sites and which .NET versions they are configured to by using aspnet_iisreg -lk. Run this command from your .NET framework directory. For ex: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319
Both the sites with different .NET framework will be listed
Hope this helps.

Install ASP.NET 4.0 alongside ASP.NET 2.0 on IIS6

I've read where you create a new application pool, one for 2.0 sites and one for 4.0 sites. But there is no option I see when creating a pool to configure the framework.
My problem is I have several 2.0 sites running as the Default Web Site. I added a WCF 4.0 service under a new virtual directory and set the framework to 4.0. I also put it in a separate app pool.
Now, I can only get one working at a time. Either the 2.0 sites or the 4.0 site. I get:
It is not possible to run two
different versions of ASP.NET in the
same IIS process. Please use the IIS
Administration Tool to reconfigure
your server to run the application in
a separate process.
Is it possible to do this under IIS6 and Windows Server 2003?
To clarify: Each app pool binds to the .NET framework of the first web site that uses it, in order of application startup. That first site will run fine, but all other sites will be restricted to the same app pool. You need at least one app pool per framework version; and in my experience, the most robust setup is one app pool per application - this way, you can switch framework versions without worrying about other applications, and you can kill individual applications through task manager when the need arises.
The App Pools don't need configuring, just make sure the 2.0 sites are running as one, and the 4.0 site running as another.

Resources