SignalR and SelfHosting ASPNet app - asp.net

I have an ASPnet webapplication that uses SignalR, it works fine under IIS.
When I try to self host the ASP.NET webapplication with System.Web.ApplicationHost.CreateApplicationHost, The signalR functionality is gone.
From debugging, I see that the OWin Startup class is never hit.
Does anyone have a clue why? From what I understand, the CreateApplicationHost is just hosting the application outside of IIS, but it still runs through the ASP.NET pipeline, So, I don't understand why Owin startup and SignalR wont work.

When hosted inside of ASP.NET, OWIN-based applications require the IIS integrated pipeline. CreateApplicationHost forces use of the ASP.NET classic pipeline.
If you want to self-host, use the HttpListener-based OWIN host rather than trying to self-host ASP.NET directly.

For instructions on self-hosting SignalR, see the following tutorial:
http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/tutorial-signalr-20-self-host

Related

SignalR, SharePoint, Owin issue

There is a scenario where we have two applications. One is share point and other obe is Web API.
For security point of view, we need to deploy second stand alone project into the firsy application.
In IIS, I deployed one application. In that folder I deployed another application and make it as web application.
Now everythings runs fine. SharePoint applicantion consume APIs correctly.
Now, I have include signalR to both application where web api application is server and share point is client.
I have global asax file and add startup file for owin signalR. If I add owin automatic startup to false then application runs fine but signalR will not work.
If I start owin then neither api work nor signalR will work.
Important point is when I run SharePoint application from IIS and run web api from visual studio and set path of web api for signalR then it works fine.
What could be the issue?

ASP.NET Core Web API living inside a ASP.NET 4 IIS Web Site

I am tasked to to build a Web API application. The app will be hosted inside an existing web site - a pre-ASP.NET 5 web application with a WCF web service.
I wonder - can I build the web-api application using ASP.NET Core 1 in a way that it can happily exists as a sub application inside the already existing site in IIS?
Thanks!
Yes, this is possible, I'm doing the opposite of this scenario but conceptually its the same thing. You need to create your subsite as a separate application in IIS with its own app pool. That app pool needs to be configured No Managed Code per the instructions on the Docs site https://docs.asp.net/en/latest/publishing/iis.html
The only other thing you need to watch out for is that the web.config in the subsite will inherit some settings from the root web.config, so you need to remove or clear things sometimes like handlers, modules, etc.
If I understand you correctly it is not possible what you want. Please refer to the following documentation about hosting ASP.NET Core on IIS: https://docs.asp.net/en/latest/publishing/iis.html.
If you specifically look at the .NET CLR version in the application pool it should be "No Managed Code" while your current website is set to a .NET framework version I assume. This is because ASP.NET Core is now cross plaform and completely web server agnostic. It even needs a little 'trick' (the ASP.NET Core Module) to work on IIS. See: "The module creates the reverse-proxy between IIS and the Kestrel server."
But if you follow the link provided above I think you'll manage to work it out.

ASP.Net web form "not" web API with Owin or self hosting?

I have an ASP.Net webform application , deployed on IIS , now I want to make it self hosted application , I found that Owin can do it , but I am unable to find a way to do it with ASP.Net webform , I have found code with Owin and webapi .I did not found any tutorial or any help on internet .
It's not possible, I go into the details here http://keyoti.com/blog/asp-net-v5web-apivnextowin-a-beginners-primer-part-1/ but basically Web Forms uses System.Web assembly, and System.Web is coupled to IIS.
You can however self host MVC with ASP.NET 5, if that is any use.
Microsoft only developed Katana/Owin partially and then realized they had to dump ASP.NET WebForms/MVC/Web API/SignalR completely and embraced the new design, ASP.NET Core.
Thus, you can only use Katana to self host Web API and SignalR officially from Microsoft. But third party vendors, such as Cassini, allow you to bundle the web server with your web app, which is another approach to achieve self hosting,
Creating a standalone ASP.NET MVC application for Windows XP

Host ASP.NET App In WCF or Generic Web Server

Objective:
We have a Windows Service/generic EXE that also hosts a WCF service (.Net 3.5). I'd like to be able to take a third party ASP.NET component in a DLL, and host it through that WCF Service.
Is this possible to do, in any way?
It seems like if you want to host a ASP.NET app, it must be through IIS, but we don't use IIS.
Is there any way that we could load the ASP.NET app into memory, make the app available through an endpoint, and receive requests back from the app?
Specifically, we'd like to take the "Microsoft.ReportViewer.WebForms.dll", expose the web form in a web page, and accept any requests back from the web form.
http://msdn.microsoft.com/en-us/library/ms251723.aspx
Looking for anything to get me started. Thx.
From owin.org
"OWIN defines a standard interface between .NET web servers and web applications. The goal of the OWIN interface is to decouple server and application, encourage the development of simple modules for .NET web development, and, by being an open standard, stimulate the open source ecosystem of .NET web development tools."
Essentially Owin implementations, like Katana (OWIN implementations for Microsoft servers and frameworks.), help you self host web apps, even in a Windows NT Service.
According to this post, hosting a WebForms app outside IIS/ASP.NET is not possible.
WebForms are tightly coupled to ASP.NET/IIS and cannot run directly on
OWIN/Katana (e.g. outside of ASP.NET/IIS). However, you should be able
to use Katana's middleware (Security, CORS, etc.) in a WebForms
application.
http://katanaproject.codeplex.com/discussions/571291

Are these usages of OWIN possible?

Is it possible to write a simple custom Console Application that includes a owin library that can host a Asp.Net Web Application directly (without katana.exe, like CassiniDev's library)?
Is it possible to let an Asp.Net Web Application including MVC 4, Web API, SignalR features hosted across IIS and owin, without / rarely changing code?
For hosting applications from the ASP .NET framework family on top of OWIN, as of this post, you can do so with WebAPI and SignalR. If you need something more like MVC and Razor, you can look at using the NancyFX web app framework for that. Maybe in future versions of MVC OWIN support will be enabled
I did an initial implementation of adapter at https://github.com/ashmind/Gate.Adapters.AspNet.
It is absolutely not production ready, but if the functionality is important for you you are welcome to test/extend it.
As far as I know there is no other reliable library for that.

Resources