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

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.

Related

Host multiple sites on one domain with IIS

I have few web apps: ASP.NET MVC 4.5, ASP.NET CORE MVC 3/6 and also blazor wasm hosted on ASP.NET CORE 6.
I want to hosst them on one domain with different paths as roots. Like this:
mydomain.com/firstsite
mydomain.com/secondsite
mydomain.com/thirdsite
and etc.
Can I do it somehow on Windows Server 2016 with IIS? Every site use his own authenticication and cookies.
Of course you can achieve this requirement, we can add virtual application under IIS site.
Mytest Steps
1. Setings in IIS
2. Important point, please note.
If we set the main site to .net framework, then the virtual application .net core site should recreate an application pool.
Because the application pool of .net core should choose No Manage Code type.
3. In your blazor webapp, you need change the default path like below.
Add the virtual path in your index.html file.

Windows Application Web service not working

I have upgraded my asp.net application from framework 2.0 to 4.0 and with this stated I am also running one web service which is in framework 2.0.
On deploying to the server, I am not able to get the output of the web service while application is running alright
Do I need to upgrade the version of web service too?
And any change in app.config file required?
The easiest way forward is going to be to upgrade the web service to v4.x as well. Each application pool can only be tied to a single version of the .Net framework. It is technically possible to host a 2.x application inside of a 4.x site, but it will save a lot of trouble in the long term to standardize on a single version of the framework.
As This article describes:
If an IIS Web application that targets the .NET Framework 3.5 or
earlier is nested inside an IIS Web application that targets the .NET
Framework 4, the compiler might report errors when it compiles the
nested application. This is because Web.config files inherit settings
from files that are higher in the configuration file hierarchy.
If you don't want to upgrade the service, your best bet is to prevent web.config inheritance. This blog post has details on a few different ways to accomplish this.

how to self host an existing asp.net webform

I am trying to self host an asp.net website / web application
Ideally web forms
Is this even possible? I have found a fortune of info on how to self host web api, or self host signalR
but I cannot find anything for a simple website (1 page) without all the overhread of iis.
I have tried using nancy, but it doesn't seem like it will run my aspx files, it has its own view engine
I have searched like you but find all about WebApi.
I remember that there is a component of windows called "Internet information services hostable web core".
You can install it by "Turn Windows Features on or off" if you are on a client windows (not on server).
Don't know if you are looking for unit test or other.
I found this page, that i'm going to read. I hope it should be usefull. Mabye if i have time i will update my post after i have made some tries.
Try here http://blogs.msdn.com/b/carlosag/archive/2008/04/14/hostyourownwebserverusingiis7.aspx
You can't self-host web forms using owin, it would require system.web. You'd need to upgrade to asp.net core to be used in the steteless Service Fabric.
Otherwise, I would create a separate SPA app to be hosted in an appservice. Just html, js and css files.

Allow asp web application in MVC site

We build a new MVC4 web site. when we tried to replace existing asp.net webforms website with new MVC4 web site there was a web application inside that website which is pointing to different folder which is having asp files. So we want to support that project as is.
example : website1.com is a website name
website1.com/Customasp is web application in different folder which has to be mainitained.
files in that are hello.asp
website.com/customasp/hello.asp is returning a 404 page. whats wrong with this.
Please help
You will need to create 2 distinct application on IIS.
One for MVC project (root) and second for your classic ASP app which should be defined as virtual directory(customasp) within MVC project.
All that will depend on what version of web server are you using.
You need to make sure that app pool for MVC running on NET 4.0 or better since it is MVC 4 and classic ASP poll running in proper format.
In IIS 7+ it should be set to "No Managed Code". Also make sure that MIME type as well as ISAPI filters properly assigned for both application separately. And if you are using IIS 7+ make sure that ASP mode is enabled because by default it is not.

Use different .Net Framework for subfolder

I have the requirement to build a simplier admin interface for a website. I believe MVC 3 (I want to use .Net 4) would be a good fit, but the main site is using webforms and .Net 3.5. Is it possible to have a subfolder using MVC 3 (I would build a new solution) without affecting the main application? Is there any issues if it possible? So I would have www.mysite.com as asp.net 3.5 web forms and www.mysite.com/simplifiedadmin as the MVC 3 project. Any help, opinions, or advice is welcomed. Thanks.
Edit:
Just to be clear to future readers, when I mention the 3.5 framework it is in reference to what I am using as a target framework in VS. The application pool will references the 2.0 framework on IIS. Thanks Josh for pointing that out.
You have to use two different Application pools, but that is certainly possible in IIS by creating a new Application within the site (in IIS Manager) and giving it a .net 4 Application Pool.
PS: You could also use ASP.net MVC 2 on .net 3.5 if that makes things simpler.
Firstly you seem to be confused about what a sub domain is. If your main site was on www.mysite.com and your administration site was on admin.mysite.com that would be a sub-domain, as it stands, from reading the question that isn't a sub-domain, you want it in a separate directory.
It is possible if you have full control over IIS - you would create an application pool for the new application with the right version of the .NET framework and then, once you've create the new directory, right click it in IIS Manager and choose convert to application. Once that's done right click the folder and choose Manage Web Site -> Advanced Settings and change the application pool.
That is not a subdomain, that is a subfolder.
A subdomain to mysite.com would be simplifiedadmin.mysite.com. (www.mysite.com is actually also a subdomain to mysite.com.) A subdomain has its own DNS record, so it's quite easy to run as a separate application, or even on a different server.
A subfolder can also run as a separate application, but it has to be on the same server. You can either put a subfolder in the web and make it an application in IIS, or you can create a virtual directory that points to a folder somewhere else on the server, and make that an appliction.

Resources