Allow asp web application in MVC site - asp.net

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.

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.

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.

I'm having trouble understanding exactly what ASP is and how to upload an ASP website

As of the start of this week I've been required to start learning how to develop websites in ASP. I have a moderate level of experience with C# through XNA, so that part of it isn't much trouble for me.
I've been following a Music Store Tutorial which takes me though setting up an "ASP.NET MVC 3" application.
I'm about done with the tutorial and have a functioning site when I run a test locally, but I don't understand what files need to be uploaded. I've worked on front-end updates for ASP websites before but they were completely different to this in terms of what files made up the site and so on.
I don't see a single .aspx page in my project which is what I assumed an ASP site was made of from experience. I'm starting to think that those projects weren't MVC projects but maybe just the "ASP.NET Web Application" style project.
Are ASP.NET and ASP.NET MVC different? From what I vaguely understand, MVC is just a framework that wraps ASP.NET? Also, is ASP something or is that just a synonym for ASP.NET? Finally back to my initial confusion, what files are to be uploaded onto the server when I want to launch an ASP.NET MVC project?
Do I just upload this entire directory and the server will handle it in the same way that the inbuilt testing ASP server does? Or is the site compiled down into a couple of files somehow and I just upload one of these directories (I think I read that somewhere).
ASP is an acronym for Active Server Pages. Pre .NET, ASP was Microsoft's first iteration scripted web pages. All of those pages typically ended with the extension .ASP.
When .NET was released, ASP was overhauled significantly and renamed ASP.NET. The new version of ASP.NET attempted to model web development similar to windows application development, where you used controls and an event handling model. That was Microsoft's primary model for web page development for many years, and it still around and supported, but today it is referred to as ASP.NET Web Forms. ASP.NET Web Forms pages typically have the .ASPX extension you mentioned.
In the mid-2000s or so, Ruby on Rails took off, using an MVC based model for developing web applications. A few years later, Microsoft released an alternate version of ASP.NET, called ASP.NET MVC, which used similar concepts. Many people feel the MVC approach is a more natural method for developing web pages than the web forms model (note epic Q/A threads on this very site a few years ago). In any case, ASP.NET MVC shares parts with ASP.NET Web Forms, but looks and works pretty differently; for one thing, there are no .ASPX pages as MVC, for the most part, uses a different form of routing to determine what to display.
That's a very brief history that glosses over a whole lot of subjects. What you've posted a screenshot of, is an ASP.NET MVC project.
As far as publishing is concerned, the typical route for publishing an ASP.NET website is to open the project in Visual Studio, select Build|Publish, and tell VS where to put it. Depending on what method you use, you may have to do additional configuration in IIS on the box where you published the site.
First off, when you say ASP, you're referring to old (obsolete) tech. ASP.NET is specifically what you're referring to in your question.
ASP.NET is a Microsoft technology which works cooperatively with the IIS server to provide a "Windows Application" type experience with web sites. Your web site logic is compiled in to a .NET DLL "Class Library." When a web request hits IIS with a URL matching your application directory, IIS starts up your application internally and maintains it.
I don't understand what files need to be uploaded
Visual Studio actually has a built in publisher available for your use. See the Build -> Publish menu in VS / Web Developer.
I don't see a single .aspx page in my project which is what I assumed an ASP site was made of from experience.
ASP.NET Web Forms uses the aspx extension for Pages, their frontend rendering component. On the other hand, ASP.NET MVC uses the concept of Views, which are not relient on a specific component. See the next paragraph.
Are ASP.NET and ASP.NET MVC different?
Yes. No. Maybe. ASP.NET contains all the "magic" which allows IIS - the web server - run the web application and serve up web pages. Volumes could (and have) been written on this. ASP.NET also supports much configuration through the means of Http Modules and Providers. These components are declared and configured through the web apps web.config file and are typically automagically created and persisted by IIS and ASP.NET. They collectively make up the glue that makes ASP.NET just work out of the box.
MVC was built on top of the existing foundation classes of ASP.NET. Some features have been loaned, a few have been replaced and more than a handful have been created in order to support the model-view-controller pattern.
For example, MVC gives us support for View Engines - a runtime library which allows us to write our Views (web pages) in a particular format. The ASPX View Engine existed during MVC's launch. Later came Razor, employing the .cshtml extension. Users of the MVC Framework have implemented a wide variety of their own view engines as well. This is possible due to the modular nature of ASP.NET and MVC.
Do I just upload this entire directory and the server will handle it in the same way that the inbuilt testing ASP server does? Or is the site compiled down into a couple of files somehow and I just upload one of these directories (I think I read that somewhere).
I would recommend using the Build -> Publish menu in Visual Studio. You may use web deploy if your host supports it, but FTP and File System methods are available as well.
The bin folder contains the class libraries required to run your web application on the server. The web.config file provides the configuration to do so. However your Views are not compiled in to the assembly. They are published as-is and are rendered lazily by the view engine.
You are probably familiar with ASP.NET WebForms, this is an MVC project. You can find more here:
ASP.NET MVC
In order to upload the site, you need to publish the website from inside Visual Studio to a local file location and then upload everything to the website.
If the target server doesn't have MVC installed, you can right click on the website project in Visual Studio and select "Add Deployable Dependencies".
This will ensure that the server has all the required files to run an MVC project.

ASP.Net MVC 3 : Production environnement

I've developed a small site with ASP.NET MVC3, I will have to deploy in the next few days, and I would like to know which prerequisite the server should have(like this I can contact their IT service to be sure they have everything).
They already have IIS 7.5, the last .net framework installed, but should they have something installed/configured for ASP.NET MVC 3? I searched, but I found only non relevant links :(
In general, ASP.NET should be installed and configured on IIS.
There're the two general methods that ASP.NET MVC application can be deployed with:
Bin Deploy - it means that you will include the asp.net mvc dlls with the published web site. This time nothing else is required, just the published web site files. Read more about it on Phil Haack's blog post
PreInstall ASP.NET MVC on server - using Microsoft Web Installer or the standalone downloader. Both links taken from ASP.NET MVC3 Home. This will install all the required dlls on server, so they will not be required to be passed along the published web site.
That's just it, nothing more. ASP.NET MVC is known to have some problems when deployed to iis 6, but for the version you are deploying to, problems are solved. Read about those problems here
You can bin deploy an MVC3 app so that it doesn't require anything other than IIS with ASP.NET and .NET 4 installed.
http://www.hanselman.com/blog/BINDeployingASPNETMVC3WithRazorToAWindowsServerWithoutMVCInstalled.aspx

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