简体   繁体   中英

How do I build a .net application on a remote server?

This question is probably more about me not knowing terminology than anything. For reference, I come from a background of "build a website in PHP/wordpress then drag and drop files into FTP - boom website works"

I've built an .NET application that runs locally in Visual Studio. All is good there. It's built using the Sitefinity nuget package if that's important.

I fired up a remote windows server and configured IIS via IIS Manager and a tutorial I found. I moved my application files (via Git) to this server and pointed the thing at my files. I can now go to localhost/SitefinityTest and see the site.

Except instead of the page, I get errors. I don't think these are errors with the application (again, works fantastic locally in VS) but something wrong with how I deployed this.

Could not load file or assembly 'Telerik.Sitefinity' or one of its dependencies. The system cannot find the file specified.

My first thought is that something is missing. At first glance, the packages directory is simply not there, so I copy-paste this from my local into my server. No change.

- C:\SitefinityTest
  - SitefinityTest (this is where my server is pointing)
    - ... all my files
  - packages (this is the missing directory I manually copied over)
  .gitattributes
  .gitignore
  SitefinityTest.sln

I'm also thinking there's some "build" step, similar to hitting "run" in VS that needs to happen before the application will work on this server?

Again, this is not my forte. I'm primarily a front-end developer and I understand MVC and code and can actually build out an application, but I don't have any fundamental understanding of how things happen behind the scenes. If there's some glaring incorrect assumption I've made please let me know.

I think you may want to try using the “publish” function built into Visual Studio. You should be able to point it at your server. I don't remember what all is involved in the process, but it's worked for me in the past.

This article may help.

https://docs.microsoft.com/en-us/dotnet/core/tutorials/publishing-with-visual-studio

Normally DLL files are not committed to Git - only the source code is committed.

That's why, on your server most probably the Bin folder is empty, hence the missing dll error.

You are right - you are missing the "build" step here.

If you have a visual studio on the server - you can build the application with it - that will generate the dlls in the bin folder from the source code.

If not, you can manually copy the entire bin folder from your localhost to the server.

On a side note, we don't use VMs anymore - we use Azure App Service. We bind it to a github repo and when we push a change to the repo - Azure pulls latest from github, builds the solution and deploys the site.

I like this automatic build option a lot.

In your case, you will have to manually do that step - either build on the server or simply copy the dll files yourself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM