简体   繁体   English

Owin / Katana System.EntryPointNotFoundException程序集位于其他位置

[英]Owin/Katana System.EntryPointNotFoundException Assembly located elsewhere

Somehow I can't find someone having the same problem. 不知何故我找不到有人遇到同样的问题。

We have a plugin based project, on the main folder we have the Plugin Starter, the Bootstrapper, and some dependencies. 我们有一个基于插件的项目,在主文件夹中有Plugin Starter,Bootstrapper和一些依赖项。

The plugins are in the "Plugins" folder and within, are some other folders. 插件在“插件”文件夹中,还有其他一些文件夹。

My Startup.cs file is as following: 我的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);

    }
}

The call is made as following: 调用如下:

WebApp.Start<Startup>("http://localhost/MyRestApi");

if I load the Assembly on the same folder, no problem, but if I load it where it "belongs", I can't get Owin to find it. 如果将程序集加载到同一文件夹中,没问题,但是如果将其加载到“所属”位置,则无法让Owin找到它。

Anyone had ever ran into this or have any idea? 有人遇到过这个问题或有任何想法吗? I might think of something like a configuration line in the App.config, but I don't find this as a solution. 我可能会想到类似App.config中的配置行的内容,但是我没有找到解决方案。

UPDATE 1: 更新1:

I get the System working again when I copy the Rest Service assembly on the main directory but then it is loaded two times, which is a big problem. 当我在主目录上复制Rest Service程序集时,系统又可以正常工作了,但是又加载了两次,这是个大问题。

When I send a Rest request, I get the following message: 发送休假请求时,收到以下消息:

{"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()"}

Ok, after wandering around on the internet, I found a solution, and namely Dependency Injection . 好的,在互联网上闲逛之后,我找到了一个解决方案,即Dependency Injection

Here in this post " How to use DI container when OwinStartup " you can find a lot of possibilities, but the one that I implemented and solved my problem, was this blog post: 在本文“ 如何在OwinStartup时使用DI容器 ”中,您可以找到很多可能性,但是我实现并解决了我的问题的一个是这篇博客:

https://damienbod.wordpress.com/2013/10/01/self-host-webapi-with-owin-and-unity/ https://damienbod.wordpress.com/2013/10/01/self-host-webapi-with-owin-and-unity/

I hope this can help anyone else. 我希望这可以帮助其他人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 System.EntryPointNotFoundException以平行红色显示在输出中 - System.EntryPointNotFoundException in Parallel red in output System.EntryPointNotFoundException:无法找到入口点 - System.EntryPointNotFoundException: Unable to find an entry point 未处理的异常:DLL中的System.EntryPointNotFoundException - Unhandled Exception: System.EntryPointNotFoundException in DLL Mono 2.8上的SWIG中的System.EntryPointNotFoundException错误 - System.EntryPointNotFoundException error in SWIG on mono 2.8 使用aff文件时System.EntryPointNotFoundException - System.EntryPointNotFoundException when using aff file System.EntryPointNotFoundException和DllImport(“ kernel32.dll”) - System.EntryPointNotFoundException and DllImport(“kernel32.dll”) 从 DLL 调用 function 时出现 System.EntryPointNotFoundException - System.EntryPointNotFoundException when calling function from DLL 在Linux中,单声道调用我的.so lib返回System.EntryPointNotFoundException - in linux, mono invoke my .so lib return System.EntryPointNotFoundException 无法使用Magick.NET:System.EntryPointNotFoundException - Can't use Magick.NET: System.EntryPointNotFoundException Excel Interop:使用Task.Run创建实例会导致异常System.EntryPointNotFoundException - Excel Interop: Creating instance with Task.Run results in exception System.EntryPointNotFoundException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM