gpt4 book ai didi

c# - 没有注册类型 'Microsoft.Framework.DependencyInjection.ServiceLookup.IServiceManifest' 的服务

转载 作者:太空宇宙 更新时间:2023-11-03 23:39:43 25 4
gpt4 key购买 nike

我正在 VisualStudio 2015 预览版中创建一个简单的 MVC 应用程序。代码正在构建,但是当我尝试运行该应用程序时,出现以下错误:

 System.InvalidOperationException
No service for type 'Microsoft.Framework.DependencyInjection.ServiceLookup.IServiceManifest' has been registered.

at Microsoft.Framework.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)


at Microsoft.Framework.DependencyInjection.ServiceProviderExtensions.GetRequiredService<T>(IServiceProvider provider)


at Microsoft.AspNet.Hosting.HostingServices.Import(IServiceProvider fallbackProvider)


at Microsoft.AspNet.Hosting.HostingServices.Create(IServiceProvider fallbackServices, IConfiguration configuration)


at Microsoft.AspNet.Loader.IIS.KlrHttpApplication.ApplicationStart(IHttpApplication application)


at Microsoft.AspNet.Loader.IIS.HttpApplicationBase.InvokeApplicationStart(IHttpApplication application)

.NET Framework version 4.0.30319.0 | Microsoft.AspNet.Loader.IIS version 1.0.0-beta2-10855 | IIS version 8.5.9748.0 (fbl_srv2_iis_dev(hseiler).131204-1218) | Need help?

在我的 project.json 文件中,我列出了以下依赖项

"dependencies": {
"Microsoft.AspNet.Server.IIS": "1.0.0-beta2",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta2",
"Microsoft.AspNet.Mvc": "6.0.0-beta2"

},

在我的 StartUp.cs 中我有以下代码

public class Startup
{

public void configureServices(IServiceCollection services)
{
services.AddMvc();
}

public void Configure(IApplicationBuilder app)
{
app.UseMvc();

}
}

如果需要任何其他信息,请告诉我。谢谢你的时间。

最佳答案

configureServices 更改为 ConfigureServices

关于c# - 没有注册类型 'Microsoft.Framework.DependencyInjection.ServiceLookup.IServiceManifest' 的服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29502869/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com