不知何故,我無法找到遇到同樣問題的人。Owin/Katana System.EntryPointNotFoundException位於其他地方的程序集
我們有一個基於插件的項目,在主文件夾中我們有插件啓動器,引導程序和一些依賴項。
這些插件位於「插件」文件夾中,並位於其他文件夾中。
我Startup.cs文件如下:
public class Startup
{
public void Configuration(IAppBuilder appBuilder)
{
appBuilder.Use(async (env, next) =>
{
new object().Info(string.Concat("Http method: ", env.Request.Method, ", path: ", env.Request.Path));
await next();
new object().Info(string.Concat("Response code: ", env.Response.StatusCode));
});
RunWebApiConfiguration(appBuilder);
}
private static void RunWebApiConfiguration(IAppBuilder appBuilder)
{
var httpConfiguration = new HttpConfiguration();
httpConfiguration.Routes.MapHttpRoute(
name: "WebApi"
, routeTemplate: "{controller}/{id}"
, defaults: new { id = RouteParameter.Optional }
);
appBuilder.UseWebApi(httpConfiguration);
}
}
電話可以撥出如下:
WebApp.Start<Startup>("http://localhost/MyRestApi");
如果我加載在大會上同一個文件夾,沒有問題,但如果我加載它「屬於」的地方,我無法讓Owin找到它。
任何人都曾遇到過這個問題或有任何想法?我可能會想到像App.config中的配置行,但我不認爲這是一個解決方案。
更新1:
我得到系統再次工作時,我複製主目錄REST服務組件,但隨後被加載兩次,這是一個很大的問題。
當我發送一個休息的要求,我得到以下信息:
{"Message":"An error has occurred.","ExceptionMessage":"Multiple types were found that match the controller named 'ExternalOrder'. This can happen if the route that services this request ('{controller}/{id}') found multiple controllers defined with the same name but differing namespaces, which is not supported.\r\n\r\nThe request for 'ExternalOrder' has found the following matching controllers:\r\nInternalOrderValidationPlugin.Controllers.ExternalOrderController\r\nInternalOrderValidationPlugin.Controllers.ExternalOrderController","ExceptionType":"System.InvalidOperationException","StackTrace":" at System.Web.Http.Dispatcher.DefaultHttpControllerSelector.SelectController(HttpRequestMessage request)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"}
我不確定你的意思。在代碼中沒有看到任何程序集加載調用...? –
@lc。插件加載是由MEF完成的,問題在於OWIN會在程序啓動時通過反射自動加載它,只需要引用它。 –