How do i deploy MVC3 website to server via ftp - asp.net-mvc

i was able to publish the website to local machine folder, where i've the bin, content, scripts, views, web, global, and packages folder.
AFter i add these folders to the root of my web server using filezilla, the website does not work. server does support asp.net 4, ii7.
What exactly are the steps. i looked for some answers googling, but none of it helped. I'd realy appreciate if you can help me figure this out, thanks
UPDATE Issue Fixed: My project was using .net 4.5 instead of 4.0...which was causing the issue on the server where I was deploying my website

There are 2 steps in order to deploy your application:
1. If ASP.NET MVC 3.0 is not installed on the server you should deploy the following set of assemblies in the bin folder of your web
application:
Microsoft.Web.Infrastructure.dll
System.Web.Helpers.dll
System.Web.Mvc.dll
System.Web.Razor.dll
System.Web.WebPages.Deployment.dll
System.Web.WebPages.dll
System.Web.WebPages.Razor.dll
you can set copy local to true but this is not available for all listed dll's or you can use some interesting future: right click on the project and select Add Deployable Dependencies with ASP.NET checkbox checked.A special folder named _bin_deployableAssemblies will be created with all necessary assemblies copied into this folder. When the project will be compiled all this assemblies will be copied into bin folder.
2. Publish the application: in a local folder and copy it to your deployment server or directly via FTP.

Marking references as Copy to Bin Directory in the properties window will make sure that the DLL is copied to the /bin directory.

Related

Why would Visual Studio be trying to copy files from outside the project to the bin and how do I fix it?

I've got a ASP.net MVC project using Telerik/Kendo controls running in Visual Studio 2015. I inherited a project form a coworker who passed it to me through Subversion/Tortoise SVN. When I compile the project on my computer, it give me permission errors about not copying to the bin. I tried changing the read only status and security on the bin folder, but I still get the message. I've never encountered this error before. Any suggestions on how to fix this? Where can I control where these files are being copied to? Maybe I can change it to put it in a file that it does have access to?
Unable to copy file "C:\Program Files (x86)\Progress\Telerik UI for
ASP.NET MVC R3
2017\spreadsheet\binaries\net40\Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.xml"
to
"......\WFC\WFC\WFC\bin\Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.xml".
Access to the path '......\WFC\WFC\WFC\bin' is denied.
1. Clean Project.
2. Open Windows Task Manager and kill vbcsCompiler.exe process.
3. Build Whole Solution. and run.
Note:
Kill vbcscompiler.exe when u see access denied. I think it's bug in vs17.
You are using telerik dlls in your solution, That's why it's pulling in your solution.

asp.net core content root is wrong on OSX

I have recently upgraded my asp.net core site to csproj and when I publish for release and run it on OSX no matter where I run the binary from the content root is /Users/MYUSERNAME. I am running the binary from the OSX desktop so I would expect the content root to be relative to this location and it worked fine before.
The line below is in my program.cs class. Is there anything I need to change with new csproj and asp.net core 1.1 packages for this to work as before?
.UseContentRoot(Directory.GetCurrentDirectory())
I also came across this issue and I have now resolved it.
So it seems that when I double click the dotnet file this was happening but my current working directory was ~ (/Users/Username).
So what I needed to do was set my current working directory to the published folder before running it.
e.g in the Terminal.
cd ~/Desktop/publish/
./DotnetRunnableFile
Where the publish folder is where my published files are and DotnetRunnableFile is the equivalent to an .exe on windows.

Using LibGit2Sharp in the Mono ASP.NET MVC project on Ubuntu

I've created ASP.NET MVC project in MonoDevelop on Ubuntu.
Using Nuget, I added LibGit2Sharp package, but it doesn't have libgit2 library compiled for linux environment.
Then I downloaded libgit2 sources and compiled them.
Now I have libgit2-06d772d.so, but when I put it into the bin folder of my asp.net mvc project, I get System.DllNotFoundException git2-06d772d
NOTE
When I create Console project and put libgit2-06d772d.so into the bin folder of this project, application works fine.
Shared objects are not loaded when they are next to a particular file, but when their directory is in the library load path. The operating system sets a few paths that are valid for all programs, but if you have your library elsewhere, you need to specify the directory yourself.
Exporting LD_LIBRARY_PATH with the dir of the library will let the library loader know what other paths you expect to load a library from. E.g. if you built libgit2 with the libgit2sharp script you might run
export LD_LIBRARY_PATH=$HOME/libgit2sharp/libgit2/build
in the console to let the OS know that any program you start from that shell where to find libgit2.
It's common for mono-based apps to provide a script for the user to run which sets up the environment before calling mono to start the actual .exe with the program.

Teambuilding and deploying a dll (e.g. wpftoolkit.extended.dll)

The app I work on needs to use the wpftoolkit.extended.dll (i.e. no source, no msi/installer, we've only got the dll). So far we've placed the dll in a c:\libs folder on both the dev's laptop and the teambuild server and it built ok on both; now for deploying we want to add it to an installer (.vdproj) and we think we'll need it in tfs's repository somewhere. However, when tested the app now only builds on the dev's laptop and not on the teambuild server (looks like a relative path thing).
So... rather than fixing the actual problem, I'm wondering what's the best/cleanest/commonlyAccepted way to do this? where should I keep the dll in the repository and where should I place the dll on the host we're deploying to?
You should use folder structure on the source control like the following
/Main Contains the .sln file
/Source
/MyApp1 Contains MyApp1.sln file
/Source Contain folder for all
/ClassLibrary1 Contains ClassLibrary1.csproj
/MyApp1Web Contains Default.aspx
/Build Contains build output (binaries)
/Docs Contains product docs etc
/Tests
**/3rdpartyDlls** Contains all vesions of third-party dlls
For more information about the source control folders and best practices, it's recommended to read the book patterns & practices Team Development with TFS Guide (Final Release)

How can I install asp.net mvc 2 on IIS7?

I have developed an ASP.NET MVC 2 website, and now need to deploy it to my web server. I've overcome some hurdles already, since ASP.NET was not installed etc. but I've now got to the point where I can serve up plain content files, and if I try to hit one of my MVC URLs I get this:
Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Not surprising, that, as I've not installed MVC2. Problem is, I can't find any good information about how to install it!
The Microsoft Download Center lists 3 files, none of which look promising:
ASP.NET-MVC-2-RTM-Release-Notes.doc
AspNetMVC2_VS2008.exe
mvc2-ms-pl.zip
The site doesn't bother to explain what the files actually are, but I assume that the last file is the source code. That's what it looks like, anyway. The release notes are no help whatsoever, since they're all about installing on your development machine, and indeed the name of the EXE makes it clear that that's all about Visual Studio integration too.
So how do I actually deploy the darn thing?
The other option linked to from Scott Gu's blog is the Microsoft Web Platform Installer. Now, I don't want to install more than just MVC2, and I already have IIS etc. set up, so this seems a bit heavy. But it's all academic, as it refuses to run on my server, saying "your system is not supported" or words to that effect. (The server is Windows Server 2008 Standard SP2, so I really don't know what it's problem is).
Help!
[It's ridiculous that this should be so hard - or perhaps not hard at all, but certainly a well-kept secret!]
To deploy an MVC application, you just need to ensure that you set the references up to copy to your bin folder. Specifically, these DLLs will need to be in there...
System.ComponentModel.DataAnnotations.dll
System.Web.Abstractions.dll
System.Web.Mvc.dll
System.Web.Routing.dll
Note: Copying a reference to your bin folder.
In practice, you do this by following these steps:
Right-click on the reference in
the "references" section of your
project
Select "Properties"
Locate the "Copy Local" property and
set it to "true"
PLEASE NOTE!
System.Web.Abstractions.dll
System.Web.Routing.dll
You only need these two if .NET 3.5 SP1 has not been installed - if you don't have SP1, you will need to include these two dlls, which are part of SP1 and are needed by MVC for routing.
The correct answer is given by Darin Dimitrov in this answer (posted here for your convenience):
You could do a server install which doesn't require Visual Studio installed:
msiexec /i AspNetMVC2.msi /l*v .\mvc.log MVC_SERVER_INSTALL="YES"
Now you are probably asking where's this AspNetMVC2.msi coming from. Actually you download AspNetMVC2_VS2008.exe from here, rename the .exe to .zip and inside you'll find what you are looking for (in the mvcruntime sub-folder).
Copy System.Web.Mvc.dll from your development machine to the application's Bin folder on the web server (or to the GAC).
This file comes from AspNetMVC2_VS2008.exe.
You do not need to put these files in the Server GAC. You can, but you don't need to.
You can simply copy these files to your /bin directory on the server. In fact, if you have Copy Local set to true when you right click on the reference, it will do just that.
You need to make sure the reference path to this file:
System.Web.Mvc.dll
is in your /bin directory.
I find running the web platform installer tool works great for getting servers and development machines running. It can be found here... http://www.microsoft.com/web/default.aspx

Resources