How to publish an ASP.NET MVC website - asp.net-mvc

I've a site that I'd like to publish to a co-located live server. I'm finding this simple task quite hard.
My problems begin with the Web Deploy tool (1.1) giving me a 401 Unauthorized as the adminstrator because port :8172 comes up in the errors and this port is blocked - but the documentation says "The default ListenURL is http://+:80/MsDeployAgentService"!
I'm loathe to open another port and I've little patience these days so I thought bu66er it, I'll create a Web Deploy package and import it into IIS on the server over RDP.
I notice first that Visual Studio doesn't use a dialog box to gather settings, or use my Publish profiles but seems to use a tab in the project properties, although I think these are ignored when importing the package anyway?
I'm now sitting in the import wizard with Application Path and Connection String. I've cleared the conn string as I think this is for some ASP stuff I don't use but when I enter nothing in the Application Path, the wizard barks at me saying that basically I'm a weirdo because most people publish to folders beneath the root site.
Now, I want my site to be site.com/Home/About and not site.com/subfolder/Home/About and I think being an MVC routed site that a subfolder will introduce other headaches. Should I go ahead and use the root?
Finally, I also want to publish a web service to www.site.com/services/soap which I think IIS can handle.
While typing this question, Amazon have delivered my IIS 7 Resource Kit, and I've been scouring the internet but actually I'm getting more confused.
Comment here seems to show consensus opinion that Publish isn't for production sites and that real men roll their own.
ASP.NET website 'Publish' vs Web Deployment Project
...I guess this was pre- Web Deployment Tool era?
I'm going to experiment on a spare box for now but any assistance is welcome.
Luke
UPDATE
The site was imported (to the root) manually with Web Deploy and it worked. If you get the error "There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' " its because your app pool is 4.0 and should be 2.0.

If you are using VS 2010, may I recommend Scott Hanselman's Web Debloyment Made Awesome?
http://www.hanselman.com/blog/WebDeploymentMadeAwesomeIfYoureUsingXCopyYoureDoingItWrong.aspx
Even if you are using VS2008, there are nice concepts there that will probably help.

I've experienced the same frustration and trouble with this as well. Coming from a Java web background where we can package everything as a single WAR and toss it on the server, the deployment process with ASP.NET seems archaic.
I currently have a python script that uses FTP to transfer the needed files to my test instance on the remote server. I have another python script that transfers those files to my live site. These scripts are smart enough to take care of differences between some of the configuration files etc..
I've found it much easier than trying to setup permissions or using the Microsoft deploy tools.

Hi you can use filezilla software to upload

Related

What is needed to open up an MVC project on a remote server?

I'm new to web development so please be kind. Anyway, I'm writing a web page in visual web developer 2012 and have hit a roadblock. I've got lots more experience with writing console applications. When writing one of those and you build the application, the bin folder is populated with the files that are required to run the application, most notable the .exe . But when I build the page all I get is .cshtml files, which when opened all it does is open the code in my web browser. I tried to get an answer on another web site but all that i got was "open it up on a web server". That doesn't make any sense to me. Please help.....
You open the project locally on your workstation, as you would any other project. But when you're ready to publish the project you would send it to a web server.
Visual Web Developer (being akin to Visual Studio, no?) should have a small built-in web server of some sort which it uses when you execute your project in debug mode. (There are more details than that, but that statement alone should be true enough to get you debugging.) That's fine for ongoing development work, but not for the resulting production application.
Analogous to installing a console application on a target workstation, you would need to publish your web application to a web server. This server may coincidentally by the same workstation on which you develop the code, but that's not a requirement.
A "web server" in this case can be one of many things. Your computer (running IIS, most likely), a server hosted somewhere, a service in the cloud, etc. And "publishing" could mean any number of things as well. Uploading the files, using built-in publishing tools in the IDE, even just committing the files to source control and allowing an automated publish service to fetch them (I do this a lot in Azure web sites).
Ultimately, the way you execute a web application that's been published isn't by double-clicking on a file anywhere. The .cshtml files, as well as any other needed files (binaries, config files, images, style sheets, etc.) are stored on a web server somewhere and you would "run" the application by making a request to that web server, which takes the form of browsing to a URL in your web browser.

How do you deploy a MVC4 .net app to production WITHOUT Web Deploy

I'm trying to deploy one of the default template apps that VS2012 generates for MVC4 to a production server (not on Azure).
It turns out that I'm not smart enough to figure out how to get Web Deploy working. After spending an hour on diagnosing different 404s, 403s, and 401s, I am ready to either ditch Web Deploy altogether, or start my project using PHP instead.
Can I just copy and paste my files and put them somewhere?
I'm fine with manually updating the database schema.
Anything else that needs to be updated?
You can publish directly to "File System" via "Publish" menu in VS (choose folder on production server). Then create WebApp on IIS with this folder (on the server) choose ApplicationPool 4.0 open port for your application if needed and start it.
What in the world makes you even think you need to use web deploy? You do realize that the web publishing wizard has several options to choose from, including FTP, file system, etc... I don't see how you could miss these.

Azure cloud service publishing - where does it go?

I created an asp.net mvc project in VS. I created an azure cloud service. Within the VS solution I added an azure project to enable me to publish to my cloud service. The cloud service has a web role and it’s published to a production environment. When I publish the project, I have my domain .cloudapp.net and I can then view my published project from a browser.
Job done. All good so far.
What I’m unclear on (and this is partly because my azure and asp.net mvc knowledge is limited) is where the project files actually reside (and the file/folder structure) and how to access them? I know they are on an IIS server somewhere but that’s about it.
With ‘traditional’ websites you have a webserver, a wwwroot folder and you stick your web pages etc into them and can see/access them through ftp etc.
Apart from wanting to know the answer to the above question I actually want to farm out the web ui (view) part to a web developer whilst I concentrate on the back end stuff. He doesn’t have visual studio so I’m unclear on how to best approach this?
I’ve noticed on the windows azure publish summary within my solution that you can enable remote desktop and enable web deploy which I suspect may be of help to me but as the solution is all working fine at the moment and I’m demoing it to a client tomorrow I’m a bit reluctant to make any last minute changes..as I’m sure we’ve all suffered the consequences of that before.
What I’m unclear on is where the project files actually reside
(and the file/folder structure) and how to access them?
As you have mentioned, these files reside on the server itself. If you connect to your server via Remote Desktop, you can see the files under D:\sitesroot folder (actual name of the folder can be found by launching IIS Manager on that server).
Having said that, it is not recommended to make changes to the files directly on the server. This is because if your server goes bad for any reason, Microsoft will provision a new server for you and it takes the code from the package file when you last deployed your application. This the changes you have made on that server will be lost.
Regarding your other question about having somebody focus on front-end development, I'm pretty sure you don't want him to working on production server directly. I'm assuming you have a centralized code repository somewhere where everybody checks in their code and then you build stuff and then deploy it.

ASP.NET4.0 MVC4 IIS7.5 Error 403.14 I'm Literally Pulling Out My Hair

I want to get away from developing in PHP but doing that is proving to be a massive headache.
I am trying to set up a website with MVC 4, ASP.NET 4.0, on Win7 Professional (64-bit). The website is just the basic site that is set up with Visual Web Developer 2010 Express selecting New Project > C# > Website > ASP.NET MVC 4 Application.
After setting up the application in IIS7.5 I am getting an HTTP Error 403.14 - Forbidden. I've done a ton of research and tried multiple different suggestions on how to solve the problem but NOTHING is working. Here are some things I tried:
Install/Register v4 of ASP.NET. This has been the most annoying
thing because everyone else's issue is fixed when they do this but
mine is not.
Changing the application pool settings:
Set to classic/integrated mode
Change the user/permissions used by the application pool
Made sure 32-bit applications were enabled
Added security permissions to folders related to the website (on multiple accounts)
I can get a regular html document to show up if I add it to the websites root directory. It seems that the MVC stack is not being called at all. The server wants to display the directory, which I can enable/disable, but the website is not being displayed.
Please can I have more potential fixes before I resort to my last desperate act? A baseball bat.
p.s. I'm more than willing to do a skype conversation or a share screen kind of thing if someone wants to dig in deep. I am beyond frustrated with this.
So it seems, in my indefinite well of stupidity, I was pointing the webserver to the incorrect folder. I needed to point the webserver to the folder with actual files of the application rather than the folder containing the .SLN file. Sorry to waste your time!
try running the aspnet_regiis
http://msdn.microsoft.com/en-us/library/k6h9cz8h.aspx
open the command line in %windir%\Microsoft.NET\Framework64\v4.0.30319 and run
aspnet_regiis -ir
other possible solutions:
quit skype, or any other similar applications

How to deploy Umbraco 5 website

I hope I'm asking this question in the right place. I also asked on umbraco forum, but did not get any response yet.
I'm having problem with deploying my Umbraco 5 website to external hosting.
On local machine, I used Umbraco 5 template for VS2010, which works fine (although it's quite slow).
When I publish to live server I get 500 error.
So far, i've tried installing fresh copy of umbraco on hosting (works fine).
I copied config files in hive provider folder (in App_Data), to point umbraco to my hosting database. That does not throw any exceptions yet. Problem starts when I copy views and partial views over - umbraco then finds the template defined in database and tries to load that.
It's worth mentioning that I also copied my project.dll file into bin directory on the server - the reason for that is because I have added new controller which inherits from surfacecontroller (in /Controllers folder).
Please let me know if I'm doing something wrong.
Cheers
Sebastian
It is not any different than deploying a MVC3 website.
There are quite a few questions with exactly that signature here on so.
Visual studio even has a few tools to help you in the process.
The publish function is found right clicking the project in the solution explorer.
If you use the template for developing, you have a working umbraco solution locally right?
If that is the case, it is easier to just deploy / publish the entire site intead of copying bits into another umbraco solution.
Publish tool
When using that tool, remember that umbraco has quite a few config files etc. and they all need to be included. So it is probably the easiest to just export all files in the folders, by changing "which files to include" setting in publish tool. That will unfortunately include all your .cs files too, but later they can be filtered out of the publish process.
First make it work, then make it awesome :)
The same goes for compilation mode, i have found that release mode sometimes breaks things, so for now just keep it in debug mode.
Then later when you have it working, you can change to release mode for a small performance gain.
Stuff to remember
include all necessary files
change connectionstrings
copy databases
custom errors, you don't want your visitors to see YSOD's with your internal debugging info.
disable tracing and debugging!
After reading this, you should go on and look for other more elaborative resources too.
"umbraco then finds the template defined in database and tries to load that" is key point to me
whatever the version you follow the templates and doc types are the backbones of umbraco ( from you website I know that you are aware with above more then me.. but repeating.) I mean you have created new website but there are no relative Templates and Doctype yet you try to use them in views and subviews and that caused the problem.
To do that please create tempalte and doctype same as is in you staging site and this problem will be solved.
Even better kick-start you development with new site only and make replica of that after defining doc-type and templates to your staging.
I hope i can explain my point.
Thanks,
Jigar
I've had problems in the past deploying Umbraco 5 projects. When you deploy an Umbraco 5 website to a new server and before you switch the website on in IIS, navigate to \App_Data\ClientDependency and delete any XML files that are there. Next, navigate to \App_Data\Umbraco\HiveConfig and delete the ConfigurationCache-*.bin files.
Once you've done that, recycle your Application Pool and start your website.

Resources