Hosting Blazor Apps at UpTime Print

  • .net, Plesk, Blazor
  • 2

Uptimes .Net hosting plans support all version of ASP.NET up to version 7 of .net core.

Blazor applications are fully supported and you can publish and host your blazor application directly from Visual Studio.

This guide will walk you through setting up the hosting environment and Visual Studio for publishing your code to the server.

Set up hosting for Blazor

  1. Ensure your domain name is pointing to the hosted server by setting the name servers correctly. If you've purchase a domain name at the same time as your hosting this will have been configured for you automatically. Otherwise you will need to set your name servers on your domain.
  2. Log into your Plesk account hosted at UpTime

Install your free SSL Certificate

  1. First thing is set to set up the SSL.  Under security you will see the following:
  2. If your SSL/TLS Certificates has an error or warning click on the icon to open the SSL settings page.  Scroll down to the bottom and click on Install for your free Let's Encrypt certificate.
  3. Tick the required boxes and click on the Get It Free button
  4. Follow the onscreen instructions to complete your SSL installation

Fine Tune Hosting for Blazor

  1. From the Websites & Domains screen in Plesk, Click on the Hosting & DNS tab and click the Hosting Settings icon.
  2. If not required, it's a good idea to turn of PHP:
    Un-tick the PHP support checkbox
  3. Scroll down to the bottom of the screen and Tick the Web Deploy Publishing checkbox.
  4. Untick both ASP checkboxes.  These enable classic ASP and are not required:
  5. You can leave all other settings at their default and then click on the OK button.

Web Application Firewall

Plesk uses a number of firewall rules to protect your account.

For initial publishing and testing, you might want to turn this onto Detect only and view the logs and then fine-tune the firewall as needed.
If your application uses PUT or authentication for example, then you may need to allow certain firewall rules.

  1. From the Dashboard tab under Websites & Domains, look for the Security section and click on the Web Application Firewall icon.
  2. For now, set to Detection Only.
  3. Click OK to save your settings.

IMPORTANT
For website security you should switch this back to On. Once you have tested your app and configured the security rules as needed.
Leaving this as Off or Detect Only will leave your site vulnerable to attacks.

There is a link on this screen that will show you the logs for firewall and rules that are stopping your application from working

Publishing Profile

Publishing your app from Visual Studio using Web Deploy is faster than FTP and ensures that all required files are compiled and uploaded to the server.

Follow these instructions to set up your Publishing Profile for fast publishing from Visual Studio.

  1. From the Dashboard tab under Websites & Domains, click on the Web Deploy Publishing Settings icon.
  2. This will download the publishing profile for visual studio. Save this to your local computer.
  3. In Visual Studio, open or create your Blazor solution.
  4. Right-click on you Blazor Project and select Publish


  5. Select Import Profile and click on Next


  6. Click on Browse and select the publish profile file you downloaded from step 2 and click on Finish


  7. From the Publish screen, Click the dropdown at the top, and select the profile ending in - Web Deploy.pubxml


  8. Your publish screen should now look like this:


  9. Click on the More actions dropdown and select Edit

  10. Selection the Connection tab and paste your Plesk hosting account password into the Password box, tick the Save password checkbox and click on the Validate Connection button. You will see a green tick after a few seconds.
  11. Click on the Save button to close the window.
  12. Now click on the Publish button at the top right.
  13. Visual Studio will now start uploading your compiled solution to the web server:
  14. Once finished you will see the success message. Click on Open site to view your published app.
  15. If any errors occur during publishing they will be shown in the Build window in Visual Studio
  16. You can now quickly publish your app at any time by selecting Publish from the Build menu in Visual Studio.

Using SQL Server

Your Blazor app is most likely to use SQL Server for data. The recommended tool for managing your database is the Microsoft SQL Server Management Studio app (SSMS). Which you can download from here: https://learn.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms

Once you have downloaded and installed SSMS follow these instructions to set up and connect to your database.

  1. Click on Databases from the left hand Plesk menu
  2. Click on the Add Database button
  3. Type in your database name and make sure you select the MS SQL server option (not MySQL)
  4. Create a database user and make sure you make a note of the password. Also ensure the password you use is Very strong.
  5. Click OK to create your database. You will now see this screen:
  6. If you have an existing database you can use the Import Dump icon to upload a database backup
  7. Now open SSMS and fill in the following:
    Server Name: <<your domain name>>
    Login: <<The username from step 4>>
    Password: <<The password from step 4>>
  8. Do not click on the Connect button just yet, instead click on the Options >> button.
  9. In the Connect to database textbox, paste in your database name you created in step 3.
  10. Now click on the Connect button.
  11. You can now view and edit your data and modify your database structure.

NOTE: You will see all databases currently installed on the server but you will only have access to your own database.

Server Errors

If you see error pages when viewing your app after publishing, check the following:

  1. Check the Web Application Firewall logs for any blocked requests. Disable Firewall rules as needed
  2. Use the Failed Requests Tracing tool under Dev Tools to start a trace. Use '401.3-999' as the status codes as a start and tick all checkboxes.
  3. Monitor the Logs section under Dev Tools for any errors

Was this answer helpful?

« Back