Releasing an WebAPI

Releasing an WebAPI

Problem Description:

So I have finished my application, everything works and it has been tested…. but what now? I am somewhat new to C# and I have never been in a position that I am in now.
I have a Windows server that is meant to constantly run this API, so how do I get this application out of VS? Normally I would just copy and .exe of the release build of my apps and run it like that, but that doesn’t seem to work.

This sounds like a thing any C# dev should know but I can’t find anything on the web, probably because "I am searching wrong", I would be really thankful I someone would show me where I can learn this part of development 😀

EDIT: Thank you all for suggestions, I feel like I left out important information about the goals of my API. This API would run locally on my companies network, my employees have a good VPN on all of our devices and they are the only ones who would use the API anyways, so I felt like running it locally is the way to go for now.

Solution – 1

There are a lot of things that go into this, but with just the information you have given so far, I would suggest reading this article on publishing your API to your server.

Solution – 2

You’re looking for how to "Publish". This article will get you most of the way I’d say.

In a (really) rough summary:

  1. Publish your code which will create the files you need a "publish" folder in the source project
  2. Set up a site in IIS on the server (I guess you might need to set up a database too)
  3. Copy the files to the server and make any changes you need to appsettings.json for things like db connection strings.

Solution – 3

The main issue with deployment is:

  • Will you do API versioning?
  • How you will maintain the code?
  • What happens when you change the code e.g. fix a bug or add a new features?
  • What happens when the new code does not work and you deploy it accidentally, how do you rollback it?
  • What kind of shutdown time is allowed?
  • Do you need continuous integration?
  • Do you need docker?
  • Do you need cloud?
  • etc…

People usually write automated deploy code nowadays, so it is not as simple as just running the code on an IIS server normally, though it depends on project size or how serious you and your bosses take it.

REST API versioning:

MsDeploy to IIS:

CI servers:


Some db versioning tools:

Rate this post
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.