不知何故,我无法找到遇到同样问题的人。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会在程序启动时通过反射自动加载它,只需要引用它。 –