Skip to content

Product docsWindows hosting

Deploy an ASP.NET site on Windows hosting

Put an ASP.NET or ASP.NET Core site live on HyperDC Windows hosting: publish it, choose the .NET runtime, upload the files and connect SQL Server from your app.

  • Intermediate
  • 25 min read
  • Updated

This guide is not available in your language yet, so it is shown in English.

On this page
  1. Before you start
  2. Step 1: Publish the application
  3. Step 2: Choose the .NET runtime
  4. Step 3: Upload the files
  5. Step 4: Create the database
  6. Step 5: Connect the application
  7. Step 6: Open the site
  8. Troubleshooting
  9. Next steps

HyperDC Windows hosting runs your site on Microsoft IIS with Microsoft SQL Server, and you manage it on your service page in the client area. This guide takes an application from your computer to a live site.

Before you start

  • Your Windows hosting service is active; see first steps.
  • Your domain points to the hosting account; see point a domain to your server.
  • The application builds and runs on your own computer.
  • It targets ASP.NET 4.x or ASP.NET Core 10. For another version, ask us in a ticket first.

Step 1: Publish the application

ASP.NET Core

Publish to a folder outside the project folder, so that later publishes do not nest. Without a runtime identifier the output is framework-dependent and uses the .NET version installed on the server:

PowerShell
dotnet publish -c Release -o ..\publish

The output contains your application's .dll files and a web.config that tells IIS to start the app.

ASP.NET 4.x

In Visual Studio, choose Publish, pick a Folder target and publish. Upload the content of that folder; it includes web.config, bin and your pages.

Verify: the output folder contains web.config.

Step 2: Choose the .NET runtime

  1. On your service page, open Websites and select Settings next to your domain.
  2. Under ASP.NET, set .NET runtime: No Managed Code (ASP.NET Core) for ASP.NET Core, or ASP.NET 4.x.
  3. Select Save Settings, then Save And Restart. The application pool restarts, so visitors may wait a few seconds.

Step 3: Upload the files

  1. Open File Manager and go into httpdocs.
  2. Select Upload, or drag files onto the panel, and upload the content of the publish folder (not the folder itself).

With many small files, it is faster to make a .zip on your computer, upload it, then choose Extract from its menu. To use an FTP client instead, see upload files on Windows hosting.

Step 4: Create the database

  1. Open Databases and select New Database.
  2. Leave Engine on SQL Server, enter a Database name and a Password, then select Create Database. The login gets the same name as the database.

Step 5: Connect the application

In the database's menu, select Connection String and copy the value. It looks like the example below. Replace YOUR_PASSWORD with your password and put it in your settings:

ASP.NET Core

In appsettings.json:

JSON
{
  "ConnectionStrings": {
    "DefaultConnection": "Server=HOST,PORT;Database=example_db;User Id=example_db;Password=YOUR_PASSWORD;TrustServerCertificate=True;"
  }
}

ASP.NET 4.x

In web.config:

XML
<connectionStrings>
  <add name="DefaultConnection"
       connectionString="Server=HOST,PORT;Database=example_db;User Id=example_db;Password=YOUR_PASSWORD;TrustServerCertificate=True;"
       providerName="System.Data.SqlClient" />
</connectionStrings>

You can edit the file in File Manager: select its name, change it and select Save File.

Step 6: Open the site

Open http://example.com. The first request can take a few seconds while the application starts.

Verify: your application loads and reads from the database.

Then secure it: free SSL on Windows hosting.

Troubleshooting

You see a default page or a directory error. The files are not in httpdocs, or you uploaded the publish folder itself instead of its content.

An HTTP 500.xx error appears. The number after the dot names the cause; see ASP.NET and IIS errors.

Files cannot be overwritten because they are in use (ASP.NET Core). A running app locks its files. Upload an empty file named app_offline.htm to httpdocs first: the ASP.NET Core Module stops the app and shows that page. Upload the new files, then delete app_offline.htm to start the app again.

Next steps

Frequently asked questions

Which .NET versions can I use?

ASP.NET 4.x and ASP.NET Core 10 are confirmed on the server. Publish ASP.NET Core framework-dependent. If your application targets another version, ask us in a ticket before you deploy.

Can I publish straight from Visual Studio?

Publish to a folder in Visual Studio, then upload the content of that folder with File Manager or FTP. Web Deploy is not available on Windows hosting.

Where do the files go?

Into the site's document root, httpdocs for your main domain. The web.config file must sit in that folder, next to your application's files.

Can I use MariaDB instead of SQL Server?

Yes. Every Windows hosting plan includes MariaDB databases as well. Choose MySQL in the Engine list and use a MySQL connector for .NET in your application.

Gerar senha

Please confirm