grpc: ASP.NET web site (not regular project) fails to find gRPC native binaries

Platform: Windows
gRPC: 1.6.0
.NET: 4.6.1
Prerequisites: VS2017 with web development installed (not just regular ASP.NET)

Repro:

  • Start VS2017

  • From the File / New menu, pick Web Site (not Project), and target .NET 4.6.1 (although I doubt that the version matters much)

  • Use “Manage NuGet packages” to add Grpc.Core

  • Add a new web form (default.aspx)

  • In the codebehind (default.aspx.cs) in the Page_Load method, add a single line:

       var channel = new Channel("localhost:8001", ChannelCredentials.Insecure);
    
  • Run the app

It will fail when it can’t load the native library, which won’t have been copied to the bin directory.

I know very little about “web site” projects, unfortunately - there’s no project file, just a packages.config.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 23 (10 by maintainers)

Most upvoted comments

We’ve never got to fix this, but given that VS2017 is quite old now and ASP.NET core (where things work fine) is now the standard, I’m going to close this issue as “Obsolete”.

Finally I solved this issue. Instead of using the Nuget package, you need to add the DLL as a reference. It works now.

Similar issue is seen when aspnetcore application, which references Grpc.Core is ran in Visual Studio 2017 using IIS launch profile.

A workaround for this is to change the app pool identity to your account.

Running published application through IIS doesn’t show this issue.