红est与IIS-运行时缺少libuv.dll [英] Kestrel with IIS - libuv.dll missing on run

查看:108
本文介绍了红est与IIS-运行时缺少libuv.dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在设置一个现有的Web API服务器,以便与现有API一起为网站提供服务.我一直在随意地

在几乎所有情况下,您可能都希望避免使用ASP.NET Core Web应用程序模板,但这是另一个讨论.

第2步:定位正确的框架

右键单击项目,然后选择 Edit xxxxxx.csproj

 < PropertyGroup>< TargetFramework> net452</TargetFramework><!-您可能还需要注意,控制台应用程序需要这些->< OutputType> Exe</OutputType>< RuntimeIdentifier> win7-x64</RuntimeIdentifier></PropertyGroup> 

选择一个您要定位的框架,并确保该框架受支持(这是一个表).
我在上面的代码片段中使用了 net452 作为示例.您可以找到有关

第3步.对所有项目重复.

您将必须对解决方案中的每个项目都执行此操作,以防止Visual Studio出现异常行为.

关于如何使ASP.NET Core与旧框架很好地协作,实际上并没有太多在线信息.希望这会对您有所帮助.我希望我早些时候有这个建议.

We're setting up an existing Web API server to serve site(s) alongside an existing API. I have been loosely following this article.

Here's what my Global.asax.cs looks like:

public class WebApiApplication : System.Web.HttpApplication
{
    protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();
        GlobalConfiguration.Configure(WebApiConfig.Register);
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        AutoMapperConfig.RegisterMappings();

        var host = new WebHostBuilder()
           .UseKestrel()
           .UseWebRoot("wwwroot")
           .UseIISIntegration()
           .UseStartup<Startup>()
           .Build();

        host.Run();
    }
}

and Startup.cs:

public partial class Startup
{
    public void Configure(IApplicationBuilder app)
    {
        app.UseDefaultFiles();
        app.UseStaticFiles();
    }
}

When I run the project, I get the error

Unable to load DLL 'libuv': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

libuv is a dependency of Kestrel. If I manually copy it from the packages folder to the bin folder, it works. That seems to make sense with this GitHub Issue comment. Now that project.json is being moved away from, how can I get it to copy automatically?

Some have posited that it does not know whether to use 32 or 64 bit version of libuv because the Platform is set to Any CPU in the project properties. I have tried setting it to x64 in both the solution and project settings and the problem persists.

How can I make libuv.dll copy directly to the build directory automatically?

I do not consider including the file in the project (instead of in the packages folder) and setting it to copy to the output directory a real solution, only a workaround. I'm hoping to find a solution, not a workaround.

解决方案

I've had a similar problem before when migrating projects. Visual Studio may misbehave a lot with mismatched projects.

Simple Answer: You need to change your projects to the MSBuild/csproj format.

To start with, if you are trying to use .NET Core in your solution, then right-click your project(s) in Visual Studio, and if you don't see Edit xxxxxx.csproj then you're likely going to have issues like the one you are reporting above.

Basically, the .NET Core project templates uses different tooling when compiling the project.

The solution below is a generic way to solve almost all issues regarding projects that try to target .NET Core, but wish to use libraries from another framework. There isn't a good tool (so far) to bridge this problem, so you're going to have to go manual-mode.


Let's get started.

The solution is quite simple (but it's a bit tedious).

Step 1: Make a new project using the new MSBuild/csproj format

Create a new project, and select ".NET Core".

In almost all cases, you probably want to avoid using the ASP.NET Core Web Application template, but that's for another discussion all together.

Step 2: Target the correct framework

Right-click the project and select Edit xxxxxx.csproj

<PropertyGroup>
    <TargetFramework>net452</TargetFramework>
    <!--you will also probably want to note that you need these for a console app -->
    <OutputType>Exe</OutputType>
    <RuntimeIdentifier>win7-x64</RuntimeIdentifier>
</PropertyGroup>

Pick a framework you want to target, and make sure that it's supported (here is a table).
I have used net452 in the above code snippet for an example. You can find out more about the naming here.

Step 3. Repeat for all projects.

You're going to have to do this for every project in your solution to keep Visual Studio from behaving unexpectedly.

There really isn't much online about how to get ASP.NET Core to work well with old frameworks. Hopefully this will help you out. I wish I had this advice earlier on myself.

这篇关于红est与IIS-运行时缺少libuv.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆