我正在尝试对 Blazor WASM 应用程序进行 docker 化,但我想使用 dotnet watch run 为本地开发环境运行该应用程序。
src 代码是默认的 Blazor WASM 模板,我刚刚将项目文件夹移动到 src 文件夹中,这是我正在使用的 dockerfile:
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY . .
ENTRYPOINT dotnet watch run --project "./src/BlazorApp/BlazorApp.csproj" --urls="http://0.0.0.0:80"
我收到以下错误:
web_1 | Building...
web_1 | Unhandled exception. System.Text.Json.JsonException: '<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
web_1 | ---> System.Text.Json.JsonReaderException: '<' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
web_1 | at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
web_1 | at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker)
web_1 | at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first)
web_1 | at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
web_1 | at System.Text.Json.Utf8JsonReader.Read()
web_1 | at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
web_1 | --- End of inner exception stack trace ---
web_1 | at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
web_1 | at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
web_1 | at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
web_1 | at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& state, JsonConverter converterBase)
web_1 | at System.Text.Json.JsonSerializer.ContinueDeserialize[TValue](ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack, JsonConverter converter, JsonSerializerOptions options)
web_1 | at System.Text.Json.JsonSerializer.ReadAll[TValue](Stream utf8Json, JsonTypeInfo jsonTypeInfo)
web_1 | at System.Text.Json.JsonSerializer.ReadAllUsingOptions[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options)
web_1 | at System.Text.Json.JsonSerializer.Deserialize[TValue](Stream utf8Json, JsonSerializerOptions options)
web_1 | at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssetsCore(IWebHostEnvironment environment, Stream manifest)
web_1 | at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssets(IWebHostEnvironment environment, IConfiguration configuration)
web_1 | at Microsoft.AspNetCore.WebHost.<>c.<ConfigureWebDefaults>b__9_0(WebHostBuilderContext ctx, IConfigurationBuilder cb)
web_1 | at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass9_0.<ConfigureAppConfiguration>b__0(HostBuilderContext context, IConfigurationBuilder builder)
web_1 | at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
web_1 | at Microsoft.Extensions.Hosting.HostBuilder.Build()
web_1 | at Microsoft.AspNetCore.Components.WebAssembly.DevServer.Server.Program.BuildWebHost(String[] args)
web_1 | at Microsoft.AspNetCore.Components.Web.DevServer.Commands.ServeCommand.Execute()
web_1 | at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
web_1 | at Microsoft.AspNetCore.Components.WebAssembly.DevServer.Program.Main(String[] args)
web_1 | watch : Exited with error code 134
从主机系统运行 dotnet watch run --project "./src/BlazorApp/BlazorApp.csproj" 就像一个魅力
有谁知道问题可能取决于什么?