self hosting asp.net mvc - asp.net-mvc

Is it possible to self host asp.net mvc inside another application ie. console, windows forms, service etc etc.
I'd like to build an app that offers a web interface to control it and I'd like to use asp.net mvc for the web part of it.
I did take a quick look at Nancy which looks like it would work, though its not asp.net mvc it did support razor although it doesn't have quite the same level of support for it as asp.net (eg. strongly typed views)
I did also find this question but it doesn't really go into much depth
Possible to use ASPNET MVC2 without IIS?

You can use "IIS 7.0 Hostable Web Core" and host the web server as part of any user process, even a console application. The benefit is that it is very similar to full blown IIS (incl config etc) but the web server itself is running in your process.
Have a look at the following articles:
Host your own Web Server in your application using IIS 7.0 Hostable Web Core
Creating Hosted Web Core Applications

Please have a look at http://cassinidev.codeplex.com/
It has many advantages for example
No need IIS 7 on client machine
Support MVC (I have tested myself)
Work well with Windows Form and Web Browser Control for packaging as Windows App
Cross Win OS platform ( Windows XP, Vista, 7) I have test XP with .NET 4 installed
Hope this helps.

I know this question is old, but it is still relevant, so with the .NET Core 1.0 + ASP.NET MVC 6 you can self-host your MVC application easily. You can even combine MVC and WebAPI applications into one, and you can decide later if you want to use IIS, IIS Express or the self-hosting feature of the .NET Core.
You can try it if you follow the Yeoman approach from this post:
https://stackoverflow.com/a/30314393/980247

Related

ASP.NET MVC 4 on Aruba

i tried to look around but i did't find a solution.
I have a web space on aruba and i want to publish the default mvc 4 internet website (you know...home, about, contacts).
I tried to publish but it dont't work.
I read about putting .aspx (useless cause no aspx pages here) or .chstml (i tried) on the route config, but nothing happend. Always HTTP Error 403.14
Does anyone tried to publish an mcv 4 website on aruba? What changes do i have to do?
I'm using Windows 2008 Hosting with, with ASP.NET 4 and Classic Pipeline
If you referring to Aruba.it hosting solutions, they doesn't support mvc projects..
Look at there Windows hosting solution
It support asp.net not asp.net mvc...
If they were support it they would have wrote it
If ASP.NET works for you, you can bundle the MVC dll's with your project (so that theres a System.web.mvc.dll in your project's bin folder.
And it should just work.
Aruba supports Mvc4. You just have to remember to publish all the dll as told by Mvison (so mvc dll, sql ce dll, and so on) and also give the write permission to that folder, otherwise they won't allow them to run (think it's a safety policy)

Does asp.net MVC need to be compiled before it’s deployed onto a web server?

I can’t get a basic MVC site to work on my web server unless I’ve compiled it first in Visual Web Developer. If it doesn’t have a dll in the Bin, it says the Namespace can’t be found.
In classic asp.net I could just upload the files and the server would compile it at first run. Is this not the case in MVC? Essentially I’d like to build an MVC site without using Visual Web Developer.
That's cause ASP.NET MVC is not based on the Website model that many ASP.NET Web Forms apps were. It is based on the Web application model.
You can read about Web Application Projects here.
I've read about people migrating the Web Application to the Web site model in ASP.NET MVC but I don't recommended it.
Yes, you do need to compile an MVC site and deploy some DLLs in a bin folder when you deploy an MVC site
You can build MVC without Visual web developer... but why?

Does ASP.NET MVC require IIS?

Does ASP.NET MVC require IIS? Could I develop an application that uses the new ASP.NET MVC framework on a client machine that does not have IIS installed?
From what i've read on the Mono site Site Link you can also run an asp.net MVC site under Mono using the Apache webserver as well.
A browser is all that is required on the client machine.
IIS is not required on the developer machine according to the download page.
Visual Web Developer 2008 Express, or the regular editions of Visual Studio will include the Cassini web server for development.
I think what you're asking is if you were to develop an ASP.NET MVC application would you need IIS on your local dev machine to run it?
The answer is, no you don't.
In short ASP.NET MVC can technically be run by any web server that can allow the website itself to handle the requests instead of the web server handling them.
You need IIS to get ASP.NET to work (MVC or WebForms). From what I know, it is ideal to have IIS 7 for MVC, but it is possible with IIS 6.
Developing a MVC application without IIS is possible, with the built-in web server integrated with VS 2008 (as been already mentioned), but for deployment, that is when you need IIS.

How do I succesfully host a asp.net mvc app on shared hosting without resorting to ugly URLs?

Let's assume we're talking about the recently released Beta version. Specifically I'm interested in a step-by-step tutorial or similar, and I'd be thrilled with information addressing how to do so on CrystalTech.
Ultimately you want a hosting environment that uses Windows Server 2008 / IIS7, which allows you configure things like mappings through the web.config rather than through IIS itself.
Failing that, your only choice is to either ask CrystalTech to enable ASP.NET wildcard mapping to your website or just stick with using .mvc extensions in your URLs.

ASP MVC server requirements - Is Server 2008 very desirable?

I read in a few places that MVC requires Windows Server 2008 for full support. Can the same be achieved on a Vista Ultimate dev machine or will some things be missing?
If you have worked with MVC, have you had trouble finding relatively inexpensive hosting for Windows Server 2008? Though hosting is not as big a concern for me right (I know I will find some) as needing a dev machine with 2008 Server.
ASP.NET MVC plays nicely with Server 2008, but this is not required. The main crux to not using Server 2008 (IIS 7) is that you will need some form of url rewriter, otherwise Server 2003 (IIS 6) will not know that you are trying to execute an asp.net app.
What you can do is use the mod_rewrite isapirewrite with IIS 6 and you are good to go.
Steve Sanderson wrote a good article here that details how to implement several options, with mod-rewrite being the 'cleanest' solution.
What do you consider "full support"?
Phil Haack has a very good post on getting MVC up and running on IIS6 - and there are a number of other questions around here on running MVC on a non-IIS7/win2k8 set-up - you certainly don't need to use something like ISAPI-rewrite or other things - it seems rather excessive to have two routing engines in your set-up - and if you're looking for a "relatively inexpensive host" are they going to have/allow something like ISAPI-Rewrite installed and available?
As for development, I've had no problems running developer environments on both XP Professional and Vista Home Premium (which comes with IIS7 if you add the bits yourself from Windows Components).
The MVC bits "require" IIS7 running in Integrated mode more than they require Windows 2008. As IIS7 is present on Vista you're pretty much good to go, provided you configure it right.
(I know my host, DiscountASP.NET (insert referral code here obviously) have IIS7 and the MVC bits all ready to go)

Resources