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

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?

Related

Why MVC in Durandal VS project template?

All the action is client side in a SPA app. The Visual Studio Durandal and Hot Towel project templates both serve the SPA out of an ASP.NET MVC application.
What, if anything, does the ASP.NET MVC infrastructure bring to the party? As far I can see all it does is make it hard to serve a WCF Web Service (ajax enabled) out of the project web.
Yet both of the project templates are set up like this. What have I missed?
As a matter of fact, ASP.NET MVC in this template is not necessary. All it does is serve the initial Razor template for the SPA and provides you with the bundling and optimization support of all the client side javascript resources for the application so that when you deploy your application you don't end up with gazillions of HTTP requests from the client to fetch all the .js crap necessary for the application to work. Of course you could perfectly fine have used the bundling feature outside of ASP.NET MVC in a simple and plain ASP.NET web application.
What, if anything, does the ASP.NET MVC infrastructure bring to the party?
See the documentation:
Hot Towel builds on the familiar and powerful ASP.NET MVC structure.
App_Start
Content
Controllers
Models
Scripts
Views
As far I can see all it does is make it hard to serve a WCF Web Service (ajax enabled) out of the project
You can't just right-click your project and add a new WCF Service?

self hosting 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

ASP.NET MVC and host problems

Hi,
I have done the following :
Start Visual Studio 2010
New Project > ASP.NET MVC
Default ASP.NET MVC project generated by VS2010
Add a couple off simple buttons on the first page
Start local IIS manager, Create a web application and point it to the ASP.NET MVC project
Set correct right on the ASP.NET MVC project folder(to the user running the thread pool in IIS7)
Browse site (http://localhost/MyTestSight/) and the first page is shown
Upload site to www.test.figurspel.net
Host sets the site to be runned on .NET 4.0
Browse www.test.figurspel.net and the site is not working?
The host has checked that tha Active Server Page is set to allow
Host has installed up to MVC 3
I could turn on the Browsable to see the file structure but this will not help to get the site running.
How do I get this asp.NET MVC web site running?
BestRegards
Is the application pool running in integrated mode the IIS site running under that application pool?
It's my understanding that if this isn't the case, the MVC site will not run.
Alternatively, have you tried this?
+1 Unicorn power HooooooO!!!!! Also I've always when hosting a site published the project to a different folder then setup the site via IIS from that folder hope this helps.

Hosting ASP.NET MVC 3 Razor Engine Site

I am working on a ASP.NET MVC 3 beta Razor engine website. Its a small project. I would like to know if its possible to deploy Razor engine site to normal hosting provider. I assume I would need to copy relevant dll's to my site bin folder. Will this work or I would need to do something more than this to successfully deploy my site to shared hosting.
Yes, it is definitely possible to deploy an ASP.NET MVC 3 app to a web hoster that doesn't have it installed. The link that tshao posted is a great start. The only requirement is that the hoster is running ASP.NET 4.
yes it is possible to run MVC 3.0 with web pages inside shared hosting. please refer this article of mine;
http://www.tugberkugurlu.com/archive/deployment-of-asp-net-mvc-3-rc-2-application-on-a-shared-hosting-environment-without-begging-the-hosting-company

Why does ASP.NET MVC have to be a web application?

I'm wondering if anyone has any insight into why ASP.NET MVC sites have to be created as a web application (compiles to single .dll) in Visual Studio as opposed to a web site (each page is a .dll)? I suspect that it has something to do with the routing. Any thoughts?
Web Applications have a .csproj file which gives a lot better control over the build process when compared to a Web Site project which is really just a set of files and folders with build managed entirely by the VS IDE as far as i'm aware.
You may be right about the routing, but another possible reason relates to project structure and the relationship between the MVC application project and it's test project.
One of the key differences between a Web Application and a Web Site is that the Web Site is a standalobe entity, it does not exist within a solution which makes it difficult to express the relationship of the test project to the application project, whereas if a web application is used then the web site and it's tests can be treated as two projects within a common solution while also getting all the benefits of using MSBuild
Okay, I figured this out. The only reason that the ASP.NET MVC application is a Web Application instead of a Web Site has to do with the unit tests. You can 'convert' an ASP.NET MVC application to a web site with very little changes, but the unit tests won't work because they have no reference to the web site. But, I'm pretty sure that you can get the unit tests to work if you start pulling your application logic (controllers, et al) into a separate class library and then reference that class library in the web site and unit tests.

Resources