Skip to footer content
Iron Academy Logo
C# Application

Deploying the API to a VPS

Tim Corey
23m 24s

Deploying a web application is a milestone in the journey of any .NET developer. Whether you’re working with ASP.NET Core, .NET Framework, or developing other types of dynamic websites, deploying your app to a Virtual Private Server (VPS) gives you full control over the hosting environment, security, and scalability.

In this detailed walkthrough, we explore how to deploy a minimal C# API to a VPS using insights from Tim Corey’s tutorial, “Deploying the API to a VPS.” From domain registration to SSL certificates and publishing via Visual Studio, Tim covers it all. If you're exploring VPS solutions or .NET Core hosting options, this guide is your gateway to hands-on deployment.

Why Use a Sample API in Web Development?

At the outset, Tim explains the value of having a sample API. It's a vital testing ground when building frontend applications with technologies like HTML, JavaScript, or even Blazor. You get the full web development experience—from backend logic to hosting and deployment.

Domain Strategy: Buy It Only When Ready

Tim stresses a key principle—don’t rush into buying a domain name the moment you get a new app idea. Many aspiring developers overspend on domains, hosting packages, and features like email servers without having a working prototype.

Instead, focus on your programming languages, data models, and API logic first. Once the project matures, that’s the time to grab your domain and hosting account. However, for this tutorial, Tim has pre-purchased thesampleapi.com via Namecheap—a reliable hosting provider he recommends.

Choosing a VPS Hosting Provider

Tim uses InterServer for this project—a VPS hosting provider he trusts for high-performance, low-cost virtual private servers. While he typically uses Azure (especially for Microsoft SQL Server or enterprise-scale deployments), Tim opts for InterServer here to showcase flexibility.

He mentions the benefits of VPS hosting plans:

  • More control than shared hosting plans

  • Better performance for dynamic websites

  • SSD storage and scalable disk space

  • Optional DDoS protection and full access to the OS

For developers comparing Linux VPS and Windows Server hosting options, Tim's use case shows how to work with both environments, though this example uses a Windows-based VPS.

Web Hosting Setup with Plesk Control Panel

Tim walks through setting up his hosting service through the Plesk control panel. VPS solutions usually grant root access or control panel access to configure your web server. He sets up the thesampleapi.com domain and configures basic web hosting.

This step includes:

  • Activating DNS hosting

  • Creating the hosting directory

  • Understanding the shared vs. dedicated server structure on VPS

Tim notes that VPS users often host multiple domains under one server instance. That’s the power of VPS over basic shared Windows hosting—it scales with your needs and can handle high traffic efficiently.

Updating DNS Settings via Namecheap

To connect the domain to the hosting provider, Tim updates the Name Server (NS) records on Namecheap to point to InterServer’s DNS. This allows the domain to resolve to the VPS IP address.

Tim says this may take up to 48 hours, but in his experience, it often completes in 15 minutes or less—a bonus for .NET developers eager to see their work live.

Installing an SSL Certificate

Security is non-negotiable in modern web applications. Tim sets up an SSL certificate using Let’s Encrypt, which offers free site encryption. He uses a wildcard SSL certificate so that subdomains like www.thesampleapi.com and api.thesampleapi.com are secured too.

This is a critical step, especially for ASP.NET Core APIs handling sensitive data. SSL certificates encrypt communication between clients and the web server, a must-have for high-performance, secure websites.

Publishing with Visual Studio

Next, Tim demonstrates how to publish the ASP.NET Core API from Visual Studio:

  1. Right-click the project → Publish

  2. Choose Folder as the target

  3. Select Release mode

  4. Set the deployment type to Framework-dependent (for environments with the appropriate .NET versions pre-installed)

If deploying to a Linux hosting environment without .NET installed, Tim suggests switching to a self-contained deployment. This bundles the required .NET Core runtime, ensuring compatibility on remote servers.

Publishing generates a set of files that can be uploaded directly to your hosting provider.

Uploading Files to the Web Server

Tim uses the file manager in the control panel to delete default files and upload the published folder. He drags the content directly from his machine into the VPS file system. Once uploaded, hitting the domain URL returns a basic "Hello World" message, indicating the app is live.

For more advanced users, he recommends automating deployment using GitHub Actions or webdev, depending on your hosting service’s capabilities.

Testing the API Endpoints

Tim then navigates to /courses, a defined route in his C# API. It returns JSON data, proving that the ASP.NET Core app is working correctly. This also confirms that the backend logic, routing, and middleware are properly handled on the web server.

Fixing the Swagger UI (Scaler/V1)

A common issue many .NET developers face is that Swagger UI (used for API documentation) only works in development mode. Tim identifies that the configuration file in the project disables Swagger in production.

He updates the OpenAPI setup in the configuration file to make it available even in production environments—essential for debugging and testing in live settings.

Redirecting the Root to Swagger UI

Rather than showing "Hello World" on the home page, Tim adds a redirect in the API’s root endpoint. Now, visiting https://thesampleapi.com will automatically redirect users to the Swagger documentation at /scaler/v1. This small change enhances usability and helps developers quickly access API specs.

Redeploying After Updates

To reflect the new changes, Tim repeats the publish-upload process. He clears the VPS file directory and re-uploads the new build. He explains that while this method results in brief downtime, it's acceptable during the development phase.

For production applications with high traffic, Tim recommends using a staging slot—a feature found in more advanced hosting plans or platforms like Azure. This allows seamless deployment without downtime.

Final Verification and API Testing

With the updated API deployed, Tim confirms:

  • SSL certificate is active

  • Endpoints return correct data

  • Swagger UI is accessible at /scaler/v1

The deployment is a success. Developers can now test against this live API from any frontend—be it Angular, React, Blazor, or even desktop apps like WPF and WinForms.

What's Next?

Tim concludes by encouraging developers to explore using the sample API with different frontends. Whether you're building dynamic websites, testing integrations, or experimenting with classic ASP or Visual Basic, this deployed API is a great asset.

You can access the live API at:

Summary

Deploying an API to a VPS is a valuable learning experience for any developer working with .NET Core, .NET Framework, or web applications in general. Tim Corey’s video illustrates the entire journey—from domain setup to final deployment—offering practical tips and best practices.

If you're considering a move to VPS hosting plans, need to avoid hidden fees from traditional web hosting companies, or want to experiment beyond shared hosting, this tutorial puts you on the right path.

Whether you're launching your first API or exploring dotnet service hosting, this guide provides clarity, control, and powerful features to build dynamic and scalable web apps.

Hero Worlddot related to Deploying the API to a VPS
Hero Affiliate related to Deploying the API to a VPS

Earn More by Sharing What You Love

Do you create content for developers working with .NET, C#, Java, Python, or Node.js? Turn your expertise into extra income!