Приложение Blazor публикует sh проблем - css и js файлы не найдены? - PullRequest
0 голосов
/ 04 марта 2020

(Visual Studio 2019 v16.4.5, Net core 3.1)

Я создал приложение Blazor, оно хорошо работает в Visual Studio. И я публикую c как самодостаточный в папке и запускаю, запустив .\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>
  1. Однако все стили css имеют 404 при открытии сайта в браузер? Приложение все еще работает (браузер получил код html)
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.
Я скопировал всю папку на сервер Windows и попытался получить доступ с моего P C. Тем не менее, он показывает следующую ошибку:
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
...