无法运行Service Fabric .NET教程 [英] Unnable to run Service Fabric .NET tutorial
问题描述
我正在尝试使用https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-tutorial-create-dotnet-app上的教程,但我得到了第一次运行时出现以下错误消息(使用静态字符串数据)。我已经可以运行已完成的代码示例,
并尝试将我自己的代码进行比较以查看为什么我的失败,即使我只是按照指示复制了代码。查看说明中提到的文件并没有给我任何线索我现在也可以掌握。有没有人知道
我缺少什么?
I'm trying the tutorial at https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-tutorial-create-dotnet-app, but I get the following error message on the first run (where static string data is used). I've can run the finished code example, and have tried to compare my own to that to see why mine fails, even though I've merely copied the code as instructed. Looking at the file mentioned in the instructions doesn't give me any clue I can grasp at the moment either. Does anybody know what I'm missing?
Started executing script 'Publish-NewServiceFabricApplication'.
powershell -NonInteractive -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command "[void](Connect-ServiceFabricCluster); Import-Module 'C:\Program Files\Microsoft SDKs\Service Fabric\Tools\PSModule\ServiceFabricSDK\ServiceFabricSDK.psm1'; Publish-NewServiceFabricApplication -ApplicationPackagePath 'C:\Dev\dotnet\Voting\Voting\pkg\Debug' -ApplicationParameterFilePath 'C:\Dev\dotnet\Voting\Voting\PublishProfiles\..\ApplicationParameters\Local.1Node.xml' -ApplicationParameter @{_WFDebugParams_='[{"""CodePackageName""":"""Code""","""CodePackageLinkFolder""":"""C:\\Dev\\dotnet\\Voting\\VotingWeb\\bin\\Debug\\netcoreapp2.1\\win7-x64""","""ConfigPackageName""":"""Config""","""ConfigPackageLinkFolder""":"""C:\\Dev\\dotnet\\Voting\\VotingWeb\\PackageRoot\\Config""","""DataPackageName""":null,"""DataPackageLinkFolder""":null,"""LockFile""":"""C:\\Dev\\dotnet\\Voting\\VotingWeb\\bin\\Debug\\netcoreapp2.1\\win7-x64\\_VS_ServiceFabric_lock.txt""","""WorkingFolder""":"""C:\\Dev\\dotnet\\Voting\\VotingWeb""","""ServiceManifestName""":"""VotingWebPkg""","""EntryPointType""":"""Main""","""DebugExePath""":null,"""DebugArguments""":null,"""DebugParametersFile""":"""C:\\Dev\\dotnet\\Voting\\VotingWeb\\bin\\Debug\\netcoreapp2.1\\win7-x64\\_VS_ServiceFabric_debug.txt"""}]'} -Action Create -SkipPackageValidation:$true -ErrorAction Stop"
Creating application...
New-ServiceFabricApplication : Could not resolve parameter 'VotingWeb_ASPNETCORE_ENVIRONMENT'.
At C:\Program Files\Microsoft SDKs\Service Fabric\Tools\PSModule\ServiceFabricSDK\Publish-NewServiceFabricApplication.p
s1:358 char:9
+ New-ServiceFabricApplication -ApplicationName $ApplicationNam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Servi...usterConnection:ClusterConnection) [New-ServiceFabr
icApplication], FabricException
+ FullyQualifiedErrorId : CreateApplicationInstanceErrorId,Microsoft.ServiceFabric.Powershell.NewApplication
Finished executing script 'Publish-NewServiceFabricApplication'.
Time elapsed: 00:00:07.6113631
推荐答案
HI,
请转到VotingWeb中的launchSettings.json文件。
Please go the launchSettings.json file in the VotingWeb.
该文件应具有"ASPNETCORE_ENVIRONMENT"。所有配置文件的环境变量。如果变量不存在,请添加。
That file should have "ASPNETCORE_ENVIRONMENT" environment variable for all the profiles. If the variable is not there, Please add.
我正在添加我的launchSettings.json文件以供参考。
I am adding my launchSettings.json file for reference.
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:51317/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"VotingWeb": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:51318"
}
}
}
试试看,让我知道
这篇关于无法运行Service Fabric .NET教程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!