在ASP.NET MVC CORE中运行应用程序时出错
大家好,
我最近设置了Visual Studio 2017,但是当我尝试启动ASP.NET MVC CORE项目时出现运行时错误:
发生System.MissingMethodException
HResult = 0x80131513
消息=未找到方法:'System.IServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)'。
Source =<无法评估异常源>
StackTrace:
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at WebApplication4.Program.Main(String [] args)in C:\ Users \qqq \ document \ visual studio 2017 \Projects\WebApplication4 \WebApplication4 \ Programr.c:第14行
当我尝试运行另一个ASP时.NET MVC CORE Project出现此错误消息:
无法启动进程C:\Program Files\dotnet\dotnet.exe。 Web服务器请求失败,状态码为500,内部服务器错误。完整的响应已写入C:\Users\qqq \ AppData \ Local \Temp \ HttpFailure_04-02-08.html。
这些错误是因为IIS错误或配置中的某些内容?
这是我的project.csproj:
Hello guys,
I am recently set up Visual Studio 2017, but When i try to start ASP.NET MVC CORE Project that runtime error appears:
System.MissingMethodException occurred
HResult=0x80131513
Message=Method not found: 'System.IServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)'.
Source=<Cannot evaluate the exception source>
StackTrace:
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at WebApplication4.Program.Main(String[] args) in C:\Users\qqq\documents\visual studio 2017\Projects\WebApplication4\WebApplication4\Program.cs:line 14
and when i try to run another ASP.NET MVC CORE Project this error message appears:
Unable to start process C:\Program Files\dotnet\dotnet.exe. The web server request failed with status code 500, Internal Server Error. The full response has been written to C:\Users\qqq\AppData\Local\Temp\HttpFailure_04-02-08.html.
Are these errors because of IIS Error or something in configuration ?
that is my project.csproj:
<pre><Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.0-preview1-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0-preview1-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0-preview1-final" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
</ItemGroup>
</Project>
我尝试了什么:
我搜索但找不到任何...
What I have tried:
I searched but cannot find any...
(PackageTargetFallback) ; portable-net45 + win8 + wp8 + wpa81; < / PackageTargetFallback >
< / PropertyGroup >
< ItemGroup >
< PackageReference 包含 = Microsoft.ApplicationInsights.AspNetCore 版本 = 2.0.0 / >
< PackageReference 包含 = Microsoft.AspNetCore 版本 = 1.1.1 / >
< PackageReference an> 包含 = Microsoft.AspNetCore.Mvc 版本 = 1.1.2 / >
< PackageReference 包含 = Microsoft.AspNetCore.StaticFiles 版本 = 1.1.1 / >
< PackageReference 包含 = Microsoft.EntityFrameworkCore 版本 = 2.0.0-preview1-final / >
< PackageReference 包含 = Microsoft。 EntityFrameworkCore.SqlServer 版本 = 2 .0.0-preview1-final / >
< PackageReference 包含 = Microsoft.EntityFrameworkCore。工具 版本 = 2.0.0-preview1-final / >
< PackageReference 包含 = Microsoft.Extensions.Logging.Debug跨度>版本 = 1.1.1 / >
< PackageReference 包含 = Microsoft.VisualStudio .Web.BrowserLink 版本 = 1.1.0 / >
< / ItemGroup >
< n> ItemGroup >
< DotNetCliToolReference 包含 = Microsoft.VisualStudio.Web.CodeGeneration.Tools 版本 = 1.0.0 / >
< / ItemGroup >
< / Project >
(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" /> <PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" /> <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" /> <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.0-preview1-final" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0-preview1-final" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0-preview1-final" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" /> <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" /> </ItemGroup> <ItemGroup> <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" /> </ItemGroup> </Project>
我尝试过:
我搜索但找不到任何...
What I have tried:
I searched but cannot find any...
这个错误通常是因为包的版本不兼容而发生的。
喜欢这个块:
This error usually happens because of incompatible versions of packages.
Like this block:
2.0.0-preview1-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0-preview1-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0-preview1-final" />
尝试将版本减少到1.1。*
这将解决您的问题..
由于某些软件包不兼容与其他的相比,它们太高或太低。
Try to reduce the versions to 1.1.*
And it will fix your problem..
Incompatible consistency because of some packages are either too high or too low compared to other ones.