Asked by:
Using a very basic Blazor page

Question
-
User952791441 posted
I've created a Blazor project that runs just fine through Visual Studio. Now, I want to access this project from a browser after I've put the project on my server. How can I do this?
My project folder named "Report" has this:
- bin
- obj
- Pages
- Properties
- Shared
- wwwroot
- _Imports.razor
- App.razor
- appsettings.Development.json
- appsettings.json
- Program.cs
- Report.csproj
- Report.sln
- Startup.cs
I placed the entire project folder on the server but when I type in: {ipaddress}/Report/ I get "Access is denied."
I know I can access the server because I can place an HTML file there and read it just fine.
What am I missing?
Monday, August 24, 2020 7:53 PM
All replies
-
User475983607 posted
What am I missing?Use Visual Studio to "Publish" the Blazor application. I generally publish to a local folder first then copy the "published" files to the host. It depends on your host. The official documentation explains how to publish Blazor applications.
Monday, August 24, 2020 8:48 PM -
User952791441 posted
Great. Except I put the newly published folder on the web server and I get a different error now: 500 Internal Server Error.
The article you linked to also says I should see a "publish" folder in: bin/Release/{target framework}/publish, but I only see a bunch of files and a "Properties" folder.
I also get no errors when publishing. I'm just not sure what I need to do to get it to publish properly.
Monday, August 24, 2020 9:26 PM -
User475983607 posted
Great. Except I put the newly published folder on the web server and I get a different error now: 500 Internal Server Error.
The article you linked to also says I should see a "publish" folder in: bin/Release/{target framework}/publish, but I only see a bunch of files and a "Properties" folder.
I also get no errors when publishing. I'm just not sure what I need to do to get it to publish properly.
I typically publish to a folder on my development machine. This folder usually is hosted by localhost IIS to make sure the app fires up. If I recall correctly, I had to install URL Rewrite otherwise a 500.19 error (invalid web.config) as Blazor has a URL rewrite configuration.
Also, make sure your host supports ASP.NET Core and the Core runtime is installed; https://dotnet.microsoft.com/download/dotnet-core/3.1
The official docs have a troubleshooting section that you should go through if all else fails; https://docs.microsoft.com/en-us/aspnet/core/test/troubleshoot?view=aspnetcore-3.1
Tuesday, August 25, 2020 12:12 PM -
User952791441 posted
Hmmm... I've installed URL Rewrite and both Core runtimes and I'm still getting the 500.19 error. I wish the error messages were more meaningful.
So let's say your publish folder is named "reports". Would you put this folder in C > inetpub > wwwroot and then access it in the browser at: http://localhost/report/
Or is there some special way to access Blazor projects?
Thanks for your feedback by the way.
Tuesday, August 25, 2020 6:19 PM -
User952791441 posted
Actually, I think I got it to work following the directions from this site: https://social.technet.microsoft.com/wiki/contents/articles/51588.blazor-deploying-an-application-on-iis-10.aspx
Tuesday, August 25, 2020 6:43 PM -
User475983607 posted
n0kx1
So let's say your publish folder is named "reports". Would you put this folder in C > inetpub > wwwroot and then access it in the browser at: http://localhost/report/
On localhost (IIS) I usually configure an application on a port other than 80 or 443. The URL will be something like localhost:1443.
n0kx1
Or is there some special way to access Blazor projects?Make sure the application pool identity has access to application folder; https://docs.microsoft.com/en-us/iis/manage/configuring-security/application-pool-identities.
Tuesday, August 25, 2020 6:58 PM -
User952791441 posted
I think I have everything setup right but I'm unable to connect to the MySQL database on the local machine. Do you know the trick for that? I've tried using the IP address and "localhost" for the address to connect to and nothing seems to work.
Tuesday, August 25, 2020 8:09 PM -
User475983607 posted
I think I have everything setup right but I'm unable to connect to the MySQL database on the local machine. Do you know the trick for that? I've tried using the IP address and "localhost" for the address to connect to and nothing seems to work.
It's been a while but I believe you just have to install the connector; https://dev.mysql.com/doc/connector-net/en/connector-net-entityframework-core.html.
The MySql docs indicate you need version 8.0.20 which supports .NET Standard 2.0. There was something about the connection string that was unexpected or different than SQL.
Anyway, you can always create a template project which will have sample code that you can copy.
dotnet new console –o mysqlefcore
https://dev.mysql.com/doc/connector-net/en/connector-net-entityframework-core-example.html
Tuesday, August 25, 2020 9:25 PM