我正在 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
我是一名优秀的程序员,十分优秀!