DotnetCore - SharpApp - 包裹模板服务器问题
DotnetCore - SharpApp - Parcel Template Server Issue
我一直在使用 ServiceStack 的 SharpApp,我阅读了文档以从 parcel-web 模板开始。
https://github.com/NetCoreTemplates/parcel-webapp
我下载了代码并使用命令提示符进入客户端文件夹。我遵循以下步骤:
npm install -g parcel-bundler
那我运行
npm run dev
然后我打开新的命令提示符并转到客户端文件夹,然后我输入
npm run server
我得到以下输出:
E:\Trace3\Samples\Trace3TaskPane\client>npm run server
my-app@0.1.0 server E:\Trace3\Samples\Trace3TaskPane\client
dotnet build -c Release ../server && node scripts/copy-server.js && web ../app/app.settings
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 31.12 ms for E:\Trace3\Samples\Trace3TaskPane\server\server.csproj.
server -> E:\Trace3\Samples\Trace3TaskPane\server\bin\Release\netcoreapp3.1\server.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.64
Using 'E:\Trace3\Samples\Trace3TaskPane\app\app.settings'
Attempting to load plugin 'plugins/server.dll', size: 4608 bytes
Unable to load one or more of the requested types.
Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
根据文档
Then to start the ServiceStack Server to host your Web App run:
$ npm run server
Which will host your App at http://localhost:5000 which in debug mode will enable hot reloading which will automatically reload your web page as it detects any file changes made by parcel.
请建议如何解决这个问题?
此致,
贾米尔
Server
库项目需要是一个 netstandard2.0
项目,该项目已在最新的 parcel-webapp 项目模板中更新,因此如果您创建一个新项目,例如:
$ x new parcel-webapp ProjectName
您应该能够 运行 预期的服务器:
$ npm run server
就像任何 .NET Core 应用程序一样,可以使用 ASPNETCORE_URLS 环境变量指定要侦听的端口和主机,您可以在 Windows 上设置在 运行 运行 npm 脚本之前,例如:
$ SET ASPNETCORE_URLS=https://localhost:8080
$ npm run server
或者,如果您愿意,可以将其包含在 package.json
的 npm 脚本中,例如:
"scripts": {
"server": "SET ASPNETCORE_URLS=https://localhost:8080 && dotnet build -c Release ../server && node scripts/copy-server.js && x ../app/app.settings",
},
To set an Environment variable in macOS or Linux remove the SET
prefix.
我一直在使用 ServiceStack 的 SharpApp,我阅读了文档以从 parcel-web 模板开始。 https://github.com/NetCoreTemplates/parcel-webapp
我下载了代码并使用命令提示符进入客户端文件夹。我遵循以下步骤:
npm install -g parcel-bundler
那我运行
npm run dev
然后我打开新的命令提示符并转到客户端文件夹,然后我输入
npm run server
我得到以下输出:
E:\Trace3\Samples\Trace3TaskPane\client>npm run server
my-app@0.1.0 server E:\Trace3\Samples\Trace3TaskPane\client dotnet build -c Release ../server && node scripts/copy-server.js && web ../app/app.settings
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 31.12 ms for E:\Trace3\Samples\Trace3TaskPane\server\server.csproj. server -> E:\Trace3\Samples\Trace3TaskPane\server\bin\Release\netcoreapp3.1\server.dll
Build succeeded. 0 Warning(s) 0 Error(s)
Time Elapsed 00:00:00.64 Using 'E:\Trace3\Samples\Trace3TaskPane\app\app.settings' Attempting to load plugin 'plugins/server.dll', size: 4608 bytes Unable to load one or more of the requested types. Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
根据文档
Then to start the ServiceStack Server to host your Web App run:
$ npm run server
Which will host your App at http://localhost:5000 which in debug mode will enable hot reloading which will automatically reload your web page as it detects any file changes made by parcel.
请建议如何解决这个问题?
此致, 贾米尔
Server
库项目需要是一个 netstandard2.0
项目,该项目已在最新的 parcel-webapp 项目模板中更新,因此如果您创建一个新项目,例如:
$ x new parcel-webapp ProjectName
您应该能够 运行 预期的服务器:
$ npm run server
就像任何 .NET Core 应用程序一样,可以使用 ASPNETCORE_URLS 环境变量指定要侦听的端口和主机,您可以在 Windows 上设置在 运行 运行 npm 脚本之前,例如:
$ SET ASPNETCORE_URLS=https://localhost:8080
$ npm run server
或者,如果您愿意,可以将其包含在 package.json
的 npm 脚本中,例如:
"scripts": {
"server": "SET ASPNETCORE_URLS=https://localhost:8080 && dotnet build -c Release ../server && node scripts/copy-server.js && x ../app/app.settings",
},
To set an Environment variable in macOS or Linux remove the
SET
prefix.