(Visual Studio 2019 v16.4.5, .Net core 3.1)
I created a Blazor application it runs well in Visual Studio.
And I public it as self-contained in a folder and start it by running .\MyApp.exe
.
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<PublishProvider>FileSystem</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<ProjectGuid>fc4c17fc-54f7-43fa-8e26-0d730fe3b546</ProjectGuid>
<publishUrl>bin\Release\netcoreapp3.1\publish\</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>
- However, all the css style are 404 when opening the site in a browser? The app still works (the browser got the html code)
approvals:9 GET https://mypc:5003/css/bootstrap/bootstrap.min.css net::ERR_ABORTED 404 (Not Found) approvals:10 GET https://mypc:5003/_content/Blazored.Modal/blazored-modal.css net::ERR_ABORTED 404 (Not Found) approvals:139 GET https://mypc:5003/scripts/blazor.polyfill.min.js net::ERR_ABORTED 404 (Not Found) approvals:11 GET https://mypc:5003/css/site.css net::ERR_ABORTED 404 (Not Found) blazor.server.js:1 [2020-03-03T22:54:02.896Z] Information: Normalizing '_blazor' to 'https://mypc:5003/_blazor'. blazor.server.js:1 WebSocket connection to 'wss://mypc:5003/_blazor?id=90bfDYi_D4y2FRhB9-zApw' failed: Error during WebSocket handshake: Unexpected response code: 400 (anonymous) @ blazor.server.js:1 (anonymous) @ blazor.server.js:1 (anonymous) @ blazor.server.js:1 (anonymous) @ blazor.server.js:1 (anonymous) @ blazor.server.js:1 L @ blazor.server.js:1 e.connect @ blazor.server.js:1 e.startTransport @ blazor.server.js:1 (anonymous) @ blazor.server.js:1 (anonymous) @ blazor.server.js:1 (anonymous) @ blazor.server.js:1 (anonymous) @ blazor.server.js:1 B @ blazor.server.js:1 e.createTransport @ blazor.server.js:1 (anonymous) @ blazor.server.js:1 (anonymous) @ blazor.server.js:1 (anonymous) @ blazor.server.js:1 a @ blazor.server.js:1 blazor.server.js:1 [2020-03-03T22:54:02.973Z] Error: Failed to start the transport 'WebSockets': Error: There was an error with the transport.
- I copied the whole folder to a Windows server and tried to access from my PC. However, it shows the following error:
PS C:\temp\netcoreapp3.1> .\MyApp.exe It was not possible to find any compatible framework version The specified framework 'Microsoft.AspNetCore.App', version '3.1.0' was not found. - The following frameworks were found: 2.2.3 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] 3.0.1 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] You can resolve the problem by installing the specified framework and/or SDK. The .NET Core frameworks can be found at: - https://aka.ms/dotnet-download