How to publish my MVC 3 web application onto IIS7 - visual-studio-2010

if possible I need total from the beginning utter beginner advice on how to get my ASP.Net MVC 3 Razor Visual Studio 10 web application live onto my IIS 7 webserver please?
I've never tried to publish this before, and wondering what I'm missing?
I've clicked "Publish" on Visual Studio Express 10, created a "published" version of the website. I've uploaded it to my webserver, however can't make it load on the net?
Appreciate some guidance please? (not sure how / what default documents work etc...?)

By far the easiest approach is to use Web Application Deployment.
This blog by Scott Gu gives a great intro
http://weblogs.asp.net/scottgu/archive/2010/07/29/vs-2010-web-deployment.aspx
The article talks about web.config transformations (ability to have a .Release and a .Debug version of your web.config). Later, that capability was generalized through an add-on package to work for any XML-structured file in your deployment (for example, I use it with NLog configuration files).
http://www.hanselman.com/blog/SlowCheetahWebconfigTransformationSyntaxNowGeneralizedForAnyXMLConfigurationFile.aspx

Related

Visual Studio 2013 / Webmatrix 3 - Can not run website and The name 'WebSecurity' does not exist in the current context

I've got a Website I originally wrote in Webmatrix 1 based on the Starter Site demo, but I have always used Visual Studio to edit it as you can debug from there.
The website works fine still, but I recently got a new laptop and it has the latest versions of Webmatrix and VS, and now I can not run the website locally, I get "Page can not be displayed" and also I am getting errors "The name 'WebSecurity' does not exist in the current context". If I specify the full name "WebMatrix.WebData.WebSecurity" then it compiles fine but will still not display the page.
I created a new Starter Site using Webmatrix 3 and it works fine (Websecurity works and website can be run and debugged locally). I have checked in _AppStart and web.config and I can not see anything obvious.
Does anyone have any idea how I can get my old website working in the new tools? Specifying the names fully is not the end of the world but I could really do with being able to run it so I can debug.
Thanks a lot,
Dave.
I have no real clue, but your original web site was developed under an ASP.Net Webpages version that probably is not installed on your new computer. As to the fix, if you haven't done it already, create a new site with web matrix (or visual studio...you can make asp.net web pages site with VS now I believe) and copy your code in and tweak where it bombs. I think the differences in ASP.Net web page versions are very minimal but there might be some gotchas. Good luck.

MVC Not Installed

I have Visual Studio 10. I installed SP1 and I can not create an MVC web project. Is there anything else I need to install?
As mentioned, you will need to do use File -> New -> Project and under Web you should be able to see the MVC project templates.
Reference: I encountered the same when I was just starting with MVC.
From your comments it looks as if you have the solution you're seeking, however I would like to mention for the sake of others that if you want to develop an MVC3 application on VS2010 SP1, you will still need to install it.
More details here.
I'm not aware of any good reason to not use MVC3 for new development, as it's contains many improvments over MVC2.

How to Deploy Asp.net MVC3 Application to the Hosting (Web hosting Providers)

I am trying deploy my asp.net mvc3 application,
here it is what i done
1. I registered a free domain for asp.net in (somee.com)
2. n i uploaded all project files to the server through (FTP FileZilla)
3. I added all Refernec also of Asp.net mvc3 (System.web.MVC, mvchelper, n all other assemblies also i added )
but when i run the application from internet http://imgur.com/OMoZT this error occurs (IIS 7.5 Error)
please can u tell me how to deploy , step by step, as i am beginner really need help to learn the beauty of this language also how to include EF4.1 codefirst thing . From basic step to end please tell me .
The error looks like it could be due to the wrong framework being set for IIS within somee.com. I've never used them but there is likely to be an option somewhere in their dashboard. Make sure this is set to use .Net Framework 4.
If you are still having problems, try following Phil Haack's blog post on bin deploying.
http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx
Then in Visual Studio, you can right click on the project and select Publish... From there you can select the FTP option.
When your hosting provider creates the website in IIS, he has to choose the .net framework target version.
If you publish the solution using a different framework version it will generate an error.

How to precompile ASP.NET 4.0 to a Single DLL with VS 2010

I recently upgraded from VS 2003 where I was working on a ASP.NET 2.0 website to VS 2010 where I have migrated to ASP.NET 4.0. So far it has been a big headache to get my site compiling with the new version. One problem was that my aspx.cs pages could not find the shared code libraries in my project. I solved this by moving my shared code to the App_Code folder (if there's a different/better way to do it please let me know).
Another issue that I am finding confusing is with pre-compilation. With VS 2003 I could click the build project button and it would precompile my site into a myweb.dll and myweb.pdb files. Now I'm having trouble doing the same in VS 2010. When I build the site in VS 2010 the dll is not created. I did manage to find an option to "Publish" the site which takes forever (like 2 minutes) and involves duplicating the site to another folder. This would have been acceptable but instead of making the single DLL file, it makes a bunch of files: App_code.compiled, app_code.dll, App_code.pdb, App_global.asax.compiled, App_global.asax.dll, App_global.asax.pdb, App_Web_lrpcway1.dll, App_Web_lrpcway1.compiled, App_Web_lrpcway1.pdb.
The application works - I can deploy it with all these files. However, I'd really like someone to explain what are the extra files and if there is a better way how to do it.
Thanks
This is the difference between a website and a web application.
You can convert your website to a web application to have it
behave more like you are used to.
The files in appCode are compiled when required to run and thus
does not provide dll.s in the bin/debug folder, but they should
be created when the application actually runs (but it is not
put in the same location).
Here is a nice write up about it Link
You can use the ASP.NET Merge Tool to combine all of the little DLLs into one big one.
http://msdn.microsoft.com/en-us/library/bb397866.aspx

What should I look out for when migrating a project from VS2003 to VS2005

In the very near future I'll be migrating some web applications from VS2003 projects to VS2005 projects.
What should I watch out for?
Anyone done this in the past and have it go bad?
How much time should I expect it will take to migrate a project?
I know this is more than one question, but please provide your experiences with anything relating to migrating projects from VS2003 to VS2005.
Thank-you
EDIT
The types of projects I will be migrating are Web Applications written in Visual Basic.
Do you absolutely have to go to VS2005 rather than straight to VS2008?
Even though Web Application Projects were implemented for VS2005, first with an add-on, and later with a service pack, IIRC, upgrading VS2003 web projects was extremely flaky.
We had a dozen or so production web sites (all written in VB.NET) running ASP.NET 1.1, and wanted to move forward... it proved a complete nightmare (even with Web Application Projects installed), and we gave up since we didn't have the resource available to persevere.
Then VS2008 came along, and I had another go.
Bingo, no problem at all. The project upgrade wizard just ran, there were a few trivial code fixes, and it just worked.
Straight from VS2003 to VS2008 in about an hour. All the sites ran off the same code base, and upgrading was as simple as copying over the folder, and changing the IIS management tool so that it specified ASP.NET 2.0.
I imagine you can guess what my recommendation would be!!
Be aware of the differences between a Web Site Project and a Web Application Project.
I really would go straight to VS2008. You can 'throttle back' your project so that it 'only' uses .NET 2.0, if that's a requirement.
As far as what to watch out for - ASP.NET 1.1 and ASP.NET 2.0 are very different creatures, I've discovered. ASP.NET 1.1 let you put objects on a web page much the way you would drop buttons, labels and text boxes on a desktop forms application. This is no longer true in 2.0. I had a LOT of self-education coming to me when I started working on my current project in that I really had to learn how to lay out presentation-layer stuff with ASP tags (divs, style sheets, etc). The code-behind was still the same - handled better in fact. This all depends on what kind of web projects you're migrating and how they were written in the first place.

Resources