问题
我正在构建服务结构应用程序.当我创建一个项目并运行它工作正常.但是当我在Api控制器中注入一个服务时,它给了我这个错误,我试图解决它,但还没有成功.
错误
System.BadImageFormatException
Could not load file or assembly ‘dotnet-aspnet-codegenerator-design’ or one of its dependencies. An attempt was made to load a program with an incorrect format.
图片
我添加了这项服务
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners() { return new ServiceInstanceListener[] { new ServiceInstanceListener(serviceContext => new KestrelCommunicationListener(serviceContext,"ServiceEndpoint",(url,listener) => { ServiceEventSource.Current.ServiceMessage(serviceContext,$"Starting Kestrel on {url}"); return new WebHostBuilder() .UseKestrel() .ConfigureServices( services => services .AddSingleton<StatelessServiceContext>(serviceContext) .AddScoped(typeof(ISendMessage),typeof(SendMessage)) ) .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup<Startup>() .UseServiceFabricIntegration(listener,ServiceFabricIntegrationOptions.None) .UseUrls(url) .Build(); })) }; }
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。