Deploying MVC file system publish on IIS7 - asp.net-mvc

I have created an MVC application in Visual Studio 2013 and I now wish to deploy this on the IIS of the server so that all employees from within the company will be able to access it via their windows login credentials.
When I run this in localhost via Visual Studio debug it works as expected but I have been trying unsuccessfully to deploy this to a network server and I am unsure of the process and would be grateful for some clarification.
I chose a file system publish from the publish options but I am unsure as to how to get this accessible as an application. I have tried adding the files via the new website wizard and tried the url of 'holidays/' which I had entered but without success. I then tried to add the same virtual directory location as an application from within this website but again this was unsuccessful.

I use Web Deploy with VS. Your target server needs to also have Web Deploy:
Installing and Configuring Web Deploy on IIS 7
Once your target server is ready, you can deploy from VS. Here's a guide on doing that (you can jump right to "Publish to IIS" section if you like):
ASP.NET Web Deployment using Visual Studio
With Web Deploy, you can choose to publish directly or use a deployment package. Once you are happy the publishing works locally, you have a level of confidence your publishing will work in your Live environment.
I would suggest that before you publish direct to a live environment, that you test publish it to your local machine or a test environment that has the same IIS version, and .NET Framework installed.

Related

TFS 2015 Release management: Specify name of the application inside a specific App Pool as the website name

I am trying to do a web deploy of a MVC application. I added Copy files to remote machine, IIS management and IIS web deployment.
I need to deploy it to an application inside App pool.
Going through the video URL below
https://app.pluralsight.com/player?course=tfs-visual-studio-2015-implementing-continuous-delivery&author=marcel-devries&name=tfs-visual-studio-2015-implementing-continuous-delivery-m4&clip=4&mode=live.
The author ask's to specify the website name. In my case the website name is the application name in the app pool.
How do I specify the application name under an app pool in website name parameter of IIS management.
Based on your description the website name shoule be the application name, so just put the application name as the website name parameter.
Please read the Overview and parameters instruction for the WinRM - IIS Web App Management task . And this Deploy: IIS Web App Manage
Besides, you can also use the MSBuild with arguments to deploy the application, refer to below links to do that:
Deploying application in a remote and local machine with TFS 2015
vNext
An ASP.NET MVC Site That’s Easy to Deploy from a TFS Build
Build and Deploy a Web Application with TFS 2017 using Web Deploy Package
UPDATE:
If you already have a website and you want to deploy your Application under the website. Then you just need to use the IIS Web App Deploy step. The Web App Management step is not needed.
Just try websitename\appname as the Website name parameter in IIS Web App Deploy step. See Parameters for IIS Application configuration

How can I deploy an asp mvc app to a different computer using IIS

Is there a way to deploy my mvc web app to another computer (which will be used as a server).
Also, in the server, there is no Visual Studio installed, how can I deploy it there?
Check out those links below:
Access from another PC
Run project on another PC

Publishing my asp.net mvc to IIS production server. should i have Visual Studio to do this

I have moved my asp.net mvc web application to our staging server and I have deploy it to IIS using visual Studio, as our staging server already contain Visual Studio .i did this bu right-click on my project and click on Publish. currently I need to move the asp.net mvc web application to production server and deploy it on IIS, but I have a couple of questions:-
Should I install visual studio inside my production server. Or it is better to avoid doing so ?
Is there a way to deploy my asp.net mvc directly to IIS , without uisng visual Studio ?
Thanks
Should I install visual studio inside my production server. Or it is better to avoid doing so ?
While you technically could, you shouldn't. There's no reason why you'd like to install visual studio on your production server since you'd only use VS to debug existing projects, however, your website should not be running in Debug Mode and it is a waste of resources to run a production website in Debug Mode. You should have your website pre-compiled and deployed in Release Mode. That said, an installation of VS will serve no purpose on a production server
Is there a way to deploy my asp.net mvc directly to IIS , without uisng visual Studio ?
Definitely, you can publish your pre-compiled website to a location in your hard-drive or even to a remote location and then manually copy the website files to your production server. That is the hard way. But, if you have Build management tool such as TeamCity integrated with source control system...then this task becomes even simpler since you can even publish projects automatically
1.bad idea. production server should have only your app code + advanced log system(nlog, etc) . nothing else.
2.
options:
xcopy deployment Compile your asp.net application and copy all the files to your server. You can do this by using FTP or shared directories. (Or anything else to transfer files.)
WebDeploy You have the possibility to deploy your asp.net webpage directly form your Visual Studio. If you go to "Build" and you choose "Publish Web". To be able to to do this you have to configure your server before. But this works automatically after you have set up everything. It's very handy since your deployment becomes easy to rebuild. http://weblogs.asp.net/scottgu/archive/2010/09/13/automating-deployment-with-microsoft-web-deploy.aspx
Web Setup - Installer Visual Studio provide also the option to build an installer. This works like installing usual software on your windows computer with the installer wizard. (See the link) http://weblogs.asp.net/scottgu/archive/2007/06/15/tip-trick-creating-packaged-asp-net-setup-programs-with-vs-2005.aspx
Manage multiple server There is also a way of managing the deployment of multiple servers. It seems to be a bit more complicated but could be interesting for professionals. (Check out on Google Microsoft Web Farm Framework 2.0
from here : Types of deployment in asp.net
Should I install visual studio inside my production server. Or it is
better to avoid doing so ?
Do not install VS on production servers. It is a bad practise.
Is there a way to deploy my asp.net mvc directly to IIS , without
uisng visual Studio ?
You can use your local Visual Studio to publish bits to remote IIS -
Automated Web Deploy using Visual Studio
Alternatively you can have new deployment strategies like let Team Foundation Server (TFS) deploy to IIS
One more option to is to FTP into Remote Web Server and push the latest bits from client side itself. I mean to ay, publish your site locally onto your file system. Then FTP into remote site using any FTP client like FileZilla. Then push the bits. For this to work, you need to configure remote server for FTP.

MVC4 WebSite 404 Error on IIS7

Set-up
I have a website built in Visual Studio 2012 using MVC 4 and .NET framework 4.5.
It is being hosted on a Windows 2008 and running IIS7.
I am using a VS2012 "Web Deploy Package" to deploy to the server. I manually copy this to the server and run the install using the web deploy cmd script option /T and then /Y. It all installs fine to the Test folder.
On the Test website in IIS the application pool is pointing to the DefaultAppPool which is set for integrated and pointing to the .Net Framework v4.0.30319
I have created a new Web Site in IIS for the application called Test and defaulted the bindings for port 80 and stopped the default web site that is in IIS.
I've created a new foldeer called Test under wwwroot which is where the Web Deploy script is set to point to, when I created the script I add "Test" as the Site/Application
When I have created the web deploy package on my local machine I am manually copying the zip file and other deploy files (cmd,*.xml) to the remote server
I have run %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i on the server and installed .net 4.5 framework and MVC framework components I could see in the Web Platform installer.
Problem
This website was previously being hosted on Windows Azure and have been able to direct publish to Azure and everything runs fine and when I go to any page it displays as expected.But on the new web server I get a 404 when I go to any page.
Everything seems to be installed as far as I can see on the web server. I was able to stop my website and re-start the default web site and add an index.htm file and that displays fine.
It almost seems like something in the MVC pipeline is not initialising. I'm using the standard Home controller with Index action that comes as part of the VS20102 MVC template as a test and that returns me a 404 when I go to /Home.
I've also tried other endpoints (I have WEB api rest endpoints off /API/* and these are returning 404 errors).
I'm just wondering if there is some basic set-up I've missed. It almost seems like some service is not running correctly and picking up the MVC website.

ASP.NET MVC Deployment Referencing Development Environment

I am trying to deploy my ASP.NET MVC 3 application using Visual Studio 2010's "Publish Web" option (build/Publish App). This generates deployment/bin, deployment/scripts, deployment/views etc.
I loaded these resulting deployment files/folders to a web server running IIS 6. Afterwards, everything seemed to run just fine on this web server.
I then started to make new updates, just to my local environment. After doing that, the deployed version of the site stopped working. I looked at the stack trace and the web server seemed to be referencing controllers.cs from my local environment, as opposed to the dll's in the bin directory on the web server.
Is there something else I need to do before deployment to tell the web server to use it's own bin files as opposed to files on my development environment?
BTW both my development machine and the web server live on the same network.
Update:
Another thing that made me suspect that the web server was referencing my local dev environment was that when a new user tried to access the application she got an IOFileNotFoundException in regards to a reference to "Interop.ActiveDs.dll". The stack trace mentioned my_local_path/Interop.ActiveDs.dll. This file was in fact not on the web server so I added it and then her error went away. The Odd thing was that all other users before her did not recieve an error about this missing reference.

Resources