Попытка начать работу с .netcore. Следовал базовым правилам сайта asp.net, но не смог.
https://www.asp.net/get-started
Я получаю ошибку (прилагается) после команды запуска dotnet.
powershell_output
Это моя первая в истории программа после новой установки последней версии SDK (на данный момент). Я попробовал консольное приложение, и оно отлично работает. Даже простое приложение с веб-шаблоном работает нормально и отображает «Hello World» в браузере. Однако, как только я добавляю «services.addMVC» в приложение, оно ломается с той же ошибкой. Я сделал все свои исследования и перепробовал много вещей, но не уверен, что происходит.
NIN@DATASCAPE C\..\dotnetcore md tryx
Directory: C:\#NIN\dotnetcore
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 30/08/2018 1:15 AM tryx
⚡ NIN@DATASCAPE C\..\dotnetcore cd tryx
⚡ NIN@DATASCAPE C\..\..\tryx dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.1.401
Commit: 91b1c13032
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.401\
Host (useful for support):
Version: 2.1.3
Commit: 124038c13e
.NET Core SDKs installed:
2.1.401 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
⚡ NIN@DATASCAPE C\..\..\tryx dotnet new webapp -o try1
The template "ASP.NET Core Web App" was created successfully.
This template contains technologies from parties other than Microsoft, see https://aka.ms/aspnetcore-template-3pn-210 for details.
Processing post-creation actions...
Running 'dotnet restore' on try1\try1.csproj...
Restoring packages for C:\#NIN\dotnetcore\tryx\try1\try1.csproj...
Generating MSBuild file C:\#NIN\dotnetcore\tryx\try1\obj\try1.csproj.nuget.g.props.
Generating MSBuild file C:\#NIN\dotnetcore\tryx\try1\obj\try1.csproj.nuget.g.targets.
Restore completed in 9.24 sec for C:\#NIN\dotnetcore\tryx\try1\try1.csproj.
Restore succeeded.
⚡ NIN@DATASCAPE C\..\..\tryx cd .\try1\
⚡ NIN@DATASCAPE C\..\..\..\try1 ls
Directory: C:\#NIN\dotnetcore\tryx\try1
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 30/08/2018 1:17 AM obj
d----- 30/08/2018 1:17 AM Pages
d----- 30/08/2018 1:17 AM Properties
d----- 30/08/2018 1:17 AM wwwroot
-a---- 30/08/2018 1:17 AM 146 appsettings.Development.json
-a---- 30/08/2018 1:17 AM 105 appsettings.json
-a---- 30/08/2018 1:17 AM 626 Program.cs
-a---- 30/08/2018 1:17 AM 1856 Startup.cs
-a---- 30/08/2018 1:17 AM 242 try1.csproj
⚡ NIN@DATASCAPE C\..\..\..\try1 dotnet dev-certs https --trust
Trusting the HTTPS development certificate was requested. A confirmation prompt will be displayed if the certificate was not previously trusted. Click yes on the prompt to trust the certificate.
A valid HTTPS certificate is already present.
⚡ NIN@DATASCAPE C\..\..\..\try1 dotnet run
Using launch settings from C:\#NIN\dotnetcore\tryx\try1\Properties\launchSettings.json...
Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: path1
at System.IO.Path.Combine(String path1, String path2)
at Microsoft.AspNetCore.Mvc.ApplicationParts.RelatedAssemblyAttribute.GetRelatedAssemblies(Assembly assembly, Boolean throwOnError, Func`2 fileExists, Func`2 loadFile)
at Microsoft.AspNetCore.Mvc.ApplicationParts.RelatedAssemblyAttribute.GetRelatedAssemblies(Assembly assembly, Boolean throwOnError)
at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationAssembliesProvider.GetRelatedAssemblies(Assembly assembly)
at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationAssembliesProvider.GetAssemblyItem(Assembly assembly)
at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationAssembliesProvider.ResolveFromDependencyContext(DependencyContext dependencyContext)
at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationAssembliesProvider.ResolveAssemblies(Assembly entryAssembly)+MoveNext()
at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateDefaultParts(String entryAssemblyName)
at Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions.GetApplicationPartManager(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions.AddMvcCore(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddMvc(IServiceCollection services)
at try1.Startup.ConfigureServices(IServiceCollection services) in C:\#NIN\dotnetcore\tryx\try1\Startup.cs:line 35
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at try1.Program.Main(String[] args) in C:\#NIN\dotnetcore\tryx\try1\Program.cs:line 17
⚡ NIN@DATASCAPE C\..\..\..\try1