What's the best way to deploy an executable process on a web server?

后端 未结 11 1404
一生所求
一生所求 2021-02-02 03:35

The original question:

The title of this question might be a bit clumsily phrased, but here\'s the situation:

I have a .NET web project deployed on my server.

11条回答
  •  自闭症患者
    2021-02-02 03:59

    VS Deployment project for a web app is not that easy to master and somewhat not reliable. What I'd suggest:

    1. Modify your Admin.exe into a .NET Windows service. Seebelow why would you need to do it.
    2. Use sc.exe, InstallUtil.exe or installer-building services like installer.codeeffects.com to reinstall your service fast on every deployment. Btw, if I remember correctly, at installer.codeeffects.com you can download a VS example code of how to build a .NET Windows service if you're new to services.

    Deployment could be done like this (assuming that your needs in automation is minimal and you're fine deploying almost manually):

    Run either of the above mentioned tools to reinstall your service first. The sc.exe and InstalUtil.exe tools support command line. Therefore, if your web app, VS and the service is running on the same machine (your development computer, I assume?), you can right-click the web project in VS, select Properties and set pre- or post-build commands in the Build Events tab there. This way your VS can automatically rebuild and reinstall your service before you publish your web app. This is the main reason why the exe program is not good in your case, a Windows service would serve you better.

    Then deploy your web app (assuming it's been build as discussed above). No biggies here, just use the Publish command from your VS or move all files of your web app except for the .cs files, /Properties/ and /obj/ folders. Or, if running from the project's folder, just right click the main page and select "View in Browser" - this will start the run time through VS without starting the debugger.

    Sorry for such a lengthy post. Did I understand your question and clarifications correctly? :)

提交回复
热议问题