AspNetCore.deps.json including runtimes/win/lib/netcoreapp2.1/System.Data.SqlClient.dll reference
Asked Answered
R

4

7

I have been chasing an issue with a AspNetCore web api project running on an Azure app service for a few days.

Basically I have a very small api project that when deployed / started - I get a 500.30 ANCM error. Cryptic enough - I pulled the event log from the app service and I find this:

<Data>Could not find inprocess request handler. 
     Captured output from invoking hostfxr: Error:
     An assembly specified in the application dependencies manifest 
     (SampleApp.Api.deps.json) was not found:
    package: 'System.Data.SqlClient', version: '4.6.1'
    path: 'runtimes/win/lib/netcoreapp2.1/System.Data.SqlClient.dll'
</Data>

Looking at the SampleApp.deps.json - sure enough I see this:

"runtimeTargets": {
      "runtimes/unix/lib/netcoreapp2.1/System.Data.SqlClient.dll": {
        "rid": "unix",
        "assetType": "runtime",
        "assemblyVersion": "4.5.0.1",
        "fileVersion": "4.6.27618.1"
      },
      "runtimes/win/lib/netcoreapp2.1/System.Data.SqlClient.dll": {
        "rid": "win",
        "assetType": "runtime",
        "assemblyVersion": "4.5.0.1",
        "fileVersion": "4.6.27618.1"
      }
    },

I have a similar (almost identical) project that is running fine on another app service. If run the

dotnet publish -c release /property:PublishWithAspNetCoreTargetManifest=true 

(the same publish command I am running with the app I am having an issue with)

I do not see this section in the runtime targets section at all in the otherapp.deps.json file.

Where is this coming from and how do I get rid of it?

Revelationist answered 20/7, 2019 at 15:54 Comment(7)
Sadly, no one answered, but I have that feeling that you've somehow fixed it! Can you share your experience? I got same exception and can't find any info on how to fix it :(Filiate
Yes I did fix it but, I cannot remember exactly what I did. It was something stupid. What version of net core are you using?Revelationist
My project is built in Azure Pipelines using SDK 3.1.101, without any errors/warnings, but after deployment to the host (Ubuntu 18.04), I'm getting error similar to what you've described aboveFiliate
@dotnetcanuck I've fixed it by manually uploading bin\Debug\netcoreapp3.1\runtimes\... to the server, into ContentRoot directory of my app. In my case only unix directory was needed from runtimes.Filiate
@dotnetcanuck can you post your dotnet publish command?Revelationist
same here. I am getting this error after deploying to host. It works fine locally. I just migrated the project to .net core 3.1 from 2.2. any solution so far?Bobble
Two years later and I have the exact same situation as @JDBennett. ASP.net app works - command-line app does not. Only difference for me is the library, package: 'Microsoft.Data.SqlClient', version: '2.1.1'. MSFT, please give us any tools to debug this.Inland
H
1

I had a similar issue, where most projects were .Net 5.0 and one class library was .NetStandard, upgrading the .NetStandard Library to .Net 5.0 fixed the issue.

I think the issue is re;ated to not having the correct runtimes for multiple platforms, ideally run with a single platform, or install all the required runtimes.

Huberty answered 3/6, 2021 at 9:26 Comment(0)
I
0

I had a similar situation

  • a aspnetcore webapp that worked
  • and a dotnet cli app that failed with an almost identical error as above

What worked for me was running dotnet publish cli-proj -r win-x64. This creates a self-contained bundle, which does not rely on any installed runtime. Then my deployment was taking all the files from bin/debug/netcoreapp3.1/win-x64/publish and pushing them to my webserver.

I'm sure the installed runtime is supposed to supply these files, but it doesn't seem to work well. This "fixed" my issue.

Inland answered 19/5, 2021 at 3:36 Comment(0)
G
0

I forgot to publish the /runtime/ folder when I published on the iis server.

Glasses answered 23/1, 2022 at 8:46 Comment(0)
P
0

Just ran into the same issue. In my case, the publish profile had target runtime set to win-x64. Changing this to portable got the publish command to generate the runtime directory and resolve the problem.

Publicspirited answered 15/2, 2022 at 16:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.