How to deploy ASP.NET MVC app via sftp - c#

My university allows me to deploy my web app only via sftp. Visual Studio deployment tool does not support sftp. What's the best way to solve that problem?

You don't need the VS publish tool.
For a ASP.NET MVC site, you need to upload contents of the project folder, except for anything that will have been compiled... Open Visual Studio, compile your project, then upload via FTP.
Upload the bin folder with the compiled dll's, along with any views, scripts (anything that will be served to the client), and config files in the folder structure inside the project directory.
Basically, upload anything that doesn't have a .cs file extension. The exact files will vary based on your project. (You don't need .pdb files, or your .csproj file either)
If a folder contains only .cs files, you don't need it since it'll be compiled in the dll's (like the Controllers folder). If a folder contains anything else (.cshtml, .js, .css, etc) then upload it.
This can all be done via an FTP client like CuteFTP, FileZilla, Cyberduck etc. Just connect to your server and upload to the directory that is set up for your application in IIS.

Related

Publish .NET Core website as a single executable file

I'm using a "ASP.NET Core with React.js" template in Visual Studio. I've configured publish process to produce a single file. While it does package all the .NET files into one executable, it still generates a separate "ClientApp" folder that contains a build of a React App.
Is there a way to embed everything inside the executable? Like, copy everything inside .zip archive, embed it as a resource and host everything from there.
I am trying to add a UI to a background service. So that a user could open a page in theirs browser and check service status. Frameworks like Electron will not work for me, as the service should be accessible from the local network, not just from the PC it's running on.
Just in case someone will have the same question in the future, I'll post my solution. First of all, I've packed a build of react app into a zip archive. Then, I've included an archive as Embedded Resource into the project. Finally, I've used Lexical.ZipFileProvider as a FileProvider for app.UseStaticFiles. And voila, the thing just works!

Publishing to Azure workaround: trying to understand compiled files to upload them by FTP

We have not been able to publish to Azure from Visual Studio (for Windows). We managed to do it with Visual Studio for Mac, but we just did not find the way in Windows. Publish seems to work with zero errors, but nothing seems to be pushed in reality. We have also realised we have created another App Service / Server somehow from Visual Studio, so maybe we are pushing to the wrong place not sure why or how to fix it.
Anyway, we have found a way to access to the published files within Visual Studio (by FTP, I guess):
We have updated files that don't need to be compiled (which sometimes does not seem to work either, by the way. Maybe because we are uploading to the wrong server? Maybe some cache stuff?).
Anyway, my question is about how to upload compiled files manually, I mean, by FTP:
May we just upload a full local folder with the compiled files to Azure?
Or maybe compiled files in local environment are different than compiled files to upload to Azure?
Thanks for the clarifications!
For compiled files, like they are all in the bin folder of your project, you need to upload the bin folder to azure via ftp.
I can confirm this behavior by using visual studio FTP deploy azure web app.

How to include .exe files as zip files while uploading to hosting?

I am using windows hosting for My asp.net mvc 4 application. While upload to server .exe files are rejected due to some security reason. Support team suggest me to upload .exe files as zip files. But visual studio 2015 .exe files are inn bin/rosyln folder csc.exe, vb.exe , etc. I hve no idea what is this and how this used. Help me to upload my asp.net application.
You have to do either one (your choice):
look for a host that works with the latest version of ASP.Net which includes roslyn compilers (the exe files you're seeing), or;
remove roslyn from your ASP.Net application
You can't just zip them up - your ASP.Net app needs (to execute) them. The 2nd option will likely be your choice with your existing provider if they restrict executables (which is actually more common than those that allow it - particularly if its shared hosting).

c# copy directory during publish

I want to copy a folder that's contained in another project into the publish directory during website publish, is this possible?
The reason for this is that I have a project with the SQL schema files for creating the database structure, ASP.NET membership schema, alongside some code to run the files against the database. I don't really like having these SQL files in my web project, that just seemed dirty. So I figured I'd store them somewhere else in the solution. But when I deploy I do need them in the publish directory.
Why not place these scripts in App_data? It will be deployed along with the rest of the website, and cannot be accessed via client web browsers. That's what it is there for, to store data associated with your website that you don't want to have in the root for security purposes.
You can include an extra folder for deployment with all its contents editing the publish profile: http://www.asp.net/mvc/tutorials/deployment/visual-studio-web-deployment/deploying-extra-files

How do I unpublish a .Net application

I published a C# .net application to the wrong folder. I am using VS 2005. How do I unpublish the app to be able to republish in the correct folder.
I tried simply publishing to another folder and now the app will not run from either location.
You will need to manually delete all the published files from the wrong folder.
There is no "recall"/"unpublish" function in VS. All "publish" does is compile and copy compiled files and other included files and folders (images, css, js etc) to the specified directory.
Publishing is essentially just a copy of the built application to the destination folder, as far as I aware. This points to a different problem in your application as being the source of your error.
More than likely your app isn't working from either folder because it's configured to use asp.net 1.1 or doesn't have asp.net installed at all on the server. If it is installed, and both 1.1 and 2.0+ are installed, it will default to 1.1, and the folder needs to be configured to use 2.0+.
But other than that, you just delete the files from the server by hand.
Publishing function also creates "Application" on the IIS, so I would probably start by opening the IIS server with "Internet information services manager", and remove the application with the wrong folder.

Categories

Resources