问题
我正在构建服务结构应用程序.当我创建一个项目并运行它工作正常.但是当我在Api控制器中注入一个服务时,它给了我这个错误,我试图解决它,但还没有成功.
System.BadImageFormatException@H_403_8@ 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(); })) }; }