c# - System.Net.Http 依赖问题

标签 c# azure azure-functions

我直接从门户(版本 ~1,http 触发器模板)创建了一个新的 C# 函数,并添加了 nuget 依赖项,如下所示:

{
  "frameworks": {
    "net46":{
      "dependencies": {
        "Google.Apis" : "1.34.0"
      }
    }
   }
}

这是相关的project.json.lock文件:

{
  "version": 2,
  "targets": {
    ".NETFramework,Version=v4.6": {
      "Google.Apis/1.34.0": {
        "type": "package",
        "dependencies": {
          "Google.Apis.Core": "1.34.0",
          "Newtonsoft.Json": "10.0.2",
          "System.Net.Http": "4.3.1"
        },
        "compile": {
          "lib/net45/Google.Apis.PlatformServices.dll": {},
          "lib/net45/Google.Apis.dll": {}
        },
        "runtime": {
          "lib/net45/Google.Apis.PlatformServices.dll": {},
          "lib/net45/Google.Apis.dll": {}
        }
      },
      "Google.Apis.Core/1.34.0": {
        "type": "package",
        "dependencies": {
          "Newtonsoft.Json": "10.0.2",
          "System.Net.Http": "4.3.1"
        },
        "compile": {
          "lib/net45/Google.Apis.Core.dll": {}
        },
        "runtime": {
          "lib/net45/Google.Apis.Core.dll": {}
        }
      },
      "Newtonsoft.Json/10.0.2": {
        "type": "package",
        "compile": {
          "lib/net45/Newtonsoft.Json.dll": {}
        },
        "runtime": {
          "lib/net45/Newtonsoft.Json.dll": {}
        }
      },
      "System.Net.Http/4.3.1": {
        "type": "package",
        "dependencies": {
          "System.Security.Cryptography.X509Certificates": "4.3.0"
        },
        "frameworkAssemblies": [
          "System",
          "System.Core",
          "mscorlib"
        ],
        "compile": {
          "ref/net46/System.Net.Http.dll": {}
        },
        "runtime": {
          "lib/net46/System.Net.Http.dll": {}
        },
        "runtimeTargets": {
          "runtimes/win/lib/net46/System.Net.Http.dll": {
            "assetType": "runtime",
            "rid": "win"
          }
        }
      },
      "System.Security.Cryptography.Algorithms/4.3.0": {
        "type": "package",
        "dependencies": {
          "System.Security.Cryptography.Primitives": "4.3.0"
        },
        "frameworkAssemblies": [
          "System.Core",
          "mscorlib"
        ],
        "compile": {
          "ref/net46/System.Security.Cryptography.Algorithms.dll": {}
        },
        "runtime": {
          "lib/net46/System.Security.Cryptography.Algorithms.dll": {}
        },
        "runtimeTargets": {
          "runtimes/win/lib/net46/System.Security.Cryptography.Algorithms.dll": {
            "assetType": "runtime",
            "rid": "win"
          }
        }
      },
      "System.Security.Cryptography.Encoding/4.3.0": {
        "type": "package",
        "frameworkAssemblies": [
          "System",
          "mscorlib"
        ],
        "compile": {
          "ref/net46/System.Security.Cryptography.Encoding.dll": {}
        },
        "runtime": {
          "lib/net46/System.Security.Cryptography.Encoding.dll": {}
        },
        "runtimeTargets": {
          "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll": {
            "assetType": "runtime",
            "rid": "unix"
          },
          "runtimes/win/lib/net46/System.Security.Cryptography.Encoding.dll": {
            "assetType": "runtime",
            "rid": "win"
          }
        }
      },
      "System.Security.Cryptography.Primitives/4.3.0": {
        "type": "package",
        "frameworkAssemblies": [
          "mscorlib"
        ],
        "compile": {
          "ref/net46/System.Security.Cryptography.Primitives.dll": {}
        },
        "runtime": {
          "lib/net46/System.Security.Cryptography.Primitives.dll": {}
        }
      },
      "System.Security.Cryptography.X509Certificates/4.3.0": {
        "type": "package",
        "dependencies": {
          "System.Security.Cryptography.Algorithms": "4.3.0",
          "System.Security.Cryptography.Encoding": "4.3.0"
        },
        "frameworkAssemblies": [
          "System",
          "System.Core",
          "mscorlib"
        ],
        "compile": {
          "ref/net46/System.Security.Cryptography.X509Certificates.dll": {}
        },
        "runtime": {
          "lib/net46/System.Security.Cryptography.X509Certificates.dll": {}
        },
        "runtimeTargets": {
          "runtimes/win/lib/net46/System.Security.Cryptography.X509Certificates.dll": {
            "assetType": "runtime",
            "rid": "win"
          }
        }
      }
    }
  },
  "libraries": {
    "Google.Apis/1.34.0": {
      "sha512": "V8Ng2gtvdgTeQvF5TtrFeFsg/YnQoas/I/b0Vg/NhKjpSo/v+i+71j7Al5kYZAADGYi0yVVWuBgHjHa4sE0o8g==",
      "type": "package",
      "path": "google.apis/1.34.0",
      "files": [
        "google.apis.1.34.0.nupkg.sha512",
        "google.apis.nuspec",
        "lib/net45/Google.Apis.PlatformServices.dll",
        "lib/net45/Google.Apis.dll",
        "lib/net45/Google.Apis.pdb",
        "lib/net45/Google.Apis.xml",
        "lib/netstandard1.3/Google.Apis.dll",
        "lib/netstandard1.3/Google.Apis.pdb",
        "lib/netstandard1.3/Google.Apis.xml"
      ]
    },
    "Google.Apis.Core/1.34.0": {
      "sha512": "a8KvNrdkRKqyVSsUtxc0LcuVN78bsaRNyw4eCA1BBpRVIShsZODrNV8Lv/E/T2h4rRGdgRXB2wJ7ZSs1CLCjdw==",
      "type": "package",
      "path": "google.apis.core/1.34.0",
      "files": [
        "google.apis.core.1.34.0.nupkg.sha512",
        "google.apis.core.nuspec",
        "lib/net45/Google.Apis.Core.dll",
        "lib/net45/Google.Apis.Core.pdb",
        "lib/net45/Google.Apis.Core.xml",
        "lib/netstandard1.3/Google.Apis.Core.dll",
        "lib/netstandard1.3/Google.Apis.Core.pdb",
        "lib/netstandard1.3/Google.Apis.Core.xml"
      ]
    },
    "Newtonsoft.Json/10.0.2": {
      "sha512": "iwElSU2IXmwGvytJsezyDML2ZWDkG2JzTYzlU/BNlmzMdlmRvbnwITsGGY74gwVEpDli1UdOLkMT7/3jxWvXzA==",
      "type": "package",
      "path": "newtonsoft.json/10.0.2",
      "files": [
        "LICENSE.md",
        "lib/net20/Newtonsoft.Json.dll",
        "lib/net20/Newtonsoft.Json.xml",
        "lib/net35/Newtonsoft.Json.dll",
        "lib/net35/Newtonsoft.Json.xml",
        "lib/net40/Newtonsoft.Json.dll",
        "lib/net40/Newtonsoft.Json.xml",
        "lib/net45/Newtonsoft.Json.dll",
        "lib/net45/Newtonsoft.Json.xml",
        "lib/netstandard1.0/Newtonsoft.Json.dll",
        "lib/netstandard1.0/Newtonsoft.Json.xml",
        "lib/netstandard1.3/Newtonsoft.Json.dll",
        "lib/netstandard1.3/Newtonsoft.Json.xml",
        "lib/portable-net40+sl5+win8+wpa81+wp8/Newtonsoft.Json.dll",
        "lib/portable-net40+sl5+win8+wpa81+wp8/Newtonsoft.Json.xml",
        "lib/portable-net45+win8+wpa81+wp8/Newtonsoft.Json.dll",
        "lib/portable-net45+win8+wpa81+wp8/Newtonsoft.Json.xml",
        "newtonsoft.json.10.0.2.nupkg.sha512",
        "newtonsoft.json.nuspec",
        "tools/install.ps1"
      ]
    },
    "System.Net.Http/4.3.1": {
      "sha512": "UrTyRczM3ZvNk6oetBuwlu67MFKKRva+r7bw4JDVZ6Y2IukyZ24td5ppsieu/4yZlogVAIuZul9GIQ3hoiz0yA==",
      "type": "package",
      "path": "system.net.http/4.3.1",
      "files": [
        "ThirdPartyNotices.txt",
        "dotnet_library_license.txt",
        "lib/Xamarinmac20/_._",
        "lib/monoandroid10/_._",
        "lib/monotouch10/_._",
        "lib/net45/_._",
        "lib/net46/System.Net.Http.dll",
        "lib/portable-net45+win8+wpa81/_._",
        "lib/win8/_._",
        "lib/wpa81/_._",
        "lib/xamarinios10/_._",
        "lib/xamarintvos10/_._",
        "lib/xamarinwatchos10/_._",
        "ref/Xamarinmac20/_._",
        "ref/monoandroid10/_._",
        "ref/monotouch10/_._",
        "ref/net45/_._",
        "ref/net46/System.Net.Http.dll",
        "ref/net46/System.Net.Http.xml",
        "ref/net46/de/System.Net.Http.xml",
        "ref/net46/es/System.Net.Http.xml",
        "ref/net46/fr/System.Net.Http.xml",
        "ref/net46/it/System.Net.Http.xml",
        "ref/net46/ja/System.Net.Http.xml",
        "ref/net46/ko/System.Net.Http.xml",
        "ref/net46/ru/System.Net.Http.xml",
        "ref/net46/zh-hans/System.Net.Http.xml",
        "ref/net46/zh-hant/System.Net.Http.xml",
        "ref/netcore50/System.Net.Http.dll",
        "ref/netcore50/System.Net.Http.xml",
        "ref/netcore50/de/System.Net.Http.xml",
        "ref/netcore50/es/System.Net.Http.xml",
        "ref/netcore50/fr/System.Net.Http.xml",
        "ref/netcore50/it/System.Net.Http.xml",
        "ref/netcore50/ja/System.Net.Http.xml",
        "ref/netcore50/ko/System.Net.Http.xml",
        "ref/netcore50/ru/System.Net.Http.xml",
        "ref/netcore50/zh-hans/System.Net.Http.xml",
        "ref/netcore50/zh-hant/System.Net.Http.xml",
        "ref/netstandard1.1/System.Net.Http.dll",
        "ref/netstandard1.1/System.Net.Http.xml",
        "ref/netstandard1.1/de/System.Net.Http.xml",
        "ref/netstandard1.1/es/System.Net.Http.xml",
        "ref/netstandard1.1/fr/System.Net.Http.xml",
        "ref/netstandard1.1/it/System.Net.Http.xml",
        "ref/netstandard1.1/ja/System.Net.Http.xml",
        "ref/netstandard1.1/ko/System.Net.Http.xml",
        "ref/netstandard1.1/ru/System.Net.Http.xml",
        "ref/netstandard1.1/zh-hans/System.Net.Http.xml",
        "ref/netstandard1.1/zh-hant/System.Net.Http.xml",
        "ref/netstandard1.3/System.Net.Http.dll",
        "ref/netstandard1.3/System.Net.Http.xml",
        "ref/netstandard1.3/de/System.Net.Http.xml",
        "ref/netstandard1.3/es/System.Net.Http.xml",
        "ref/netstandard1.3/fr/System.Net.Http.xml",
        "ref/netstandard1.3/it/System.Net.Http.xml",
        "ref/netstandard1.3/ja/System.Net.Http.xml",
        "ref/netstandard1.3/ko/System.Net.Http.xml",
        "ref/netstandard1.3/ru/System.Net.Http.xml",
        "ref/netstandard1.3/zh-hans/System.Net.Http.xml",
        "ref/netstandard1.3/zh-hant/System.Net.Http.xml",
        "ref/portable-net45+win8+wpa81/_._",
        "ref/win8/_._",
        "ref/wpa81/_._",
        "ref/xamarinios10/_._",
        "ref/xamarintvos10/_._",
        "ref/xamarinwatchos10/_._",
        "runtimes/unix/lib/netstandard1.6/System.Net.Http.dll",
        "runtimes/win/lib/net46/System.Net.Http.dll",
        "runtimes/win/lib/netcore50/System.Net.Http.dll",
        "runtimes/win/lib/netstandard1.3/System.Net.Http.dll",
        "system.net.http.4.3.1.nupkg.sha512",
        "system.net.http.nuspec"
      ]
    },
    "System.Security.Cryptography.Algorithms/4.3.0": {
      "sha512": "W1kd2Y8mYSCgc3ULTAZ0hOP2dSdG5YauTb1089T0/kRcN2MpSAW1izOFROrJgxSlMn3ArsgHXagigyi+ibhevg==",
      "type": "package",
      "path": "system.security.cryptography.algorithms/4.3.0",
      "files": [
        "ThirdPartyNotices.txt",
        "dotnet_library_license.txt",
        "lib/MonoAndroid10/_._",
        "lib/MonoTouch10/_._",
        "lib/net46/System.Security.Cryptography.Algorithms.dll",
        "lib/net461/System.Security.Cryptography.Algorithms.dll",
        "lib/net463/System.Security.Cryptography.Algorithms.dll",
        "lib/xamarinios10/_._",
        "lib/xamarinmac20/_._",
        "lib/xamarintvos10/_._",
        "lib/xamarinwatchos10/_._",
        "ref/MonoAndroid10/_._",
        "ref/MonoTouch10/_._",
        "ref/net46/System.Security.Cryptography.Algorithms.dll",
        "ref/net461/System.Security.Cryptography.Algorithms.dll",
        "ref/net463/System.Security.Cryptography.Algorithms.dll",
        "ref/netstandard1.3/System.Security.Cryptography.Algorithms.dll",
        "ref/netstandard1.4/System.Security.Cryptography.Algorithms.dll",
        "ref/netstandard1.6/System.Security.Cryptography.Algorithms.dll",
        "ref/xamarinios10/_._",
        "ref/xamarinmac20/_._",
        "ref/xamarintvos10/_._",
        "ref/xamarinwatchos10/_._",
        "runtimes/osx/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll",
        "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll",
        "runtimes/win/lib/net46/System.Security.Cryptography.Algorithms.dll",
        "runtimes/win/lib/net461/System.Security.Cryptography.Algorithms.dll",
        "runtimes/win/lib/net463/System.Security.Cryptography.Algorithms.dll",
        "runtimes/win/lib/netcore50/System.Security.Cryptography.Algorithms.dll",
        "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll",
        "system.security.cryptography.algorithms.4.3.0.nupkg.sha512",
        "system.security.cryptography.algorithms.nuspec"
      ]
    },
    "System.Security.Cryptography.Encoding/4.3.0": {
      "sha512": "1DEWjZZly9ae9C79vFwqaO5kaOlI5q+3/55ohmq/7dpDyDfc8lYe7YVxJUZ5MF/NtbkRjwFRo14yM4OEo9EmDw==",
      "type": "package",
      "path": "system.security.cryptography.encoding/4.3.0",
      "files": [
        "ThirdPartyNotices.txt",
        "dotnet_library_license.txt",
        "lib/MonoAndroid10/_._",
        "lib/MonoTouch10/_._",
        "lib/net46/System.Security.Cryptography.Encoding.dll",
        "lib/xamarinios10/_._",
        "lib/xamarinmac20/_._",
        "lib/xamarintvos10/_._",
        "lib/xamarinwatchos10/_._",
        "ref/MonoAndroid10/_._",
        "ref/MonoTouch10/_._",
        "ref/net46/System.Security.Cryptography.Encoding.dll",
        "ref/netstandard1.3/System.Security.Cryptography.Encoding.dll",
        "ref/netstandard1.3/System.Security.Cryptography.Encoding.xml",
        "ref/netstandard1.3/de/System.Security.Cryptography.Encoding.xml",
        "ref/netstandard1.3/es/System.Security.Cryptography.Encoding.xml",
        "ref/netstandard1.3/fr/System.Security.Cryptography.Encoding.xml",
        "ref/netstandard1.3/it/System.Security.Cryptography.Encoding.xml",
        "ref/netstandard1.3/ja/System.Security.Cryptography.Encoding.xml",
        "ref/netstandard1.3/ko/System.Security.Cryptography.Encoding.xml",
        "ref/netstandard1.3/ru/System.Security.Cryptography.Encoding.xml",
        "ref/netstandard1.3/zh-hans/System.Security.Cryptography.Encoding.xml",
        "ref/netstandard1.3/zh-hant/System.Security.Cryptography.Encoding.xml",
        "ref/xamarinios10/_._",
        "ref/xamarinmac20/_._",
        "ref/xamarintvos10/_._",
        "ref/xamarinwatchos10/_._",
        "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll",
        "runtimes/win/lib/net46/System.Security.Cryptography.Encoding.dll",
        "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll",
        "system.security.cryptography.encoding.4.3.0.nupkg.sha512",
        "system.security.cryptography.encoding.nuspec"
      ]
    },
    "System.Security.Cryptography.Primitives/4.3.0": {
      "sha512": "7bDIyVFNL/xKeFHjhobUAQqSpJq9YTOpbEs6mR233Et01STBMXNAc/V+BM6dwYGc95gVh/Zf+iVXWzj3mE8DWg==",
      "type": "package",
      "path": "system.security.cryptography.primitives/4.3.0",
      "files": [
        "ThirdPartyNotices.txt",
        "dotnet_library_license.txt",
        "lib/MonoAndroid10/_._",
        "lib/MonoTouch10/_._",
        "lib/net46/System.Security.Cryptography.Primitives.dll",
        "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll",
        "lib/xamarinios10/_._",
        "lib/xamarinmac20/_._",
        "lib/xamarintvos10/_._",
        "lib/xamarinwatchos10/_._",
        "ref/MonoAndroid10/_._",
        "ref/MonoTouch10/_._",
        "ref/net46/System.Security.Cryptography.Primitives.dll",
        "ref/netstandard1.3/System.Security.Cryptography.Primitives.dll",
        "ref/xamarinios10/_._",
        "ref/xamarinmac20/_._",
        "ref/xamarintvos10/_._",
        "ref/xamarinwatchos10/_._",
        "system.security.cryptography.primitives.4.3.0.nupkg.sha512",
        "system.security.cryptography.primitives.nuspec"
      ]
    },
    "System.Security.Cryptography.X509Certificates/4.3.0": {
      "sha512": "t2Tmu6Y2NtJ2um0RtcuhP7ZdNNxXEgUm2JeoA/0NvlMjAhKCnM1NX07TDl3244mVp3QU6LPEhT3HTtH1uF7IYw==",
      "type": "package",
      "path": "system.security.cryptography.x509certificates/4.3.0",
      "files": [
        "ThirdPartyNotices.txt",
        "dotnet_library_license.txt",
        "lib/MonoAndroid10/_._",
        "lib/MonoTouch10/_._",
        "lib/net46/System.Security.Cryptography.X509Certificates.dll",
        "lib/net461/System.Security.Cryptography.X509Certificates.dll",
        "lib/xamarinios10/_._",
        "lib/xamarinmac20/_._",
        "lib/xamarintvos10/_._",
        "lib/xamarinwatchos10/_._",
        "ref/MonoAndroid10/_._",
        "ref/MonoTouch10/_._",
        "ref/net46/System.Security.Cryptography.X509Certificates.dll",
        "ref/net461/System.Security.Cryptography.X509Certificates.dll",
        "ref/netstandard1.3/System.Security.Cryptography.X509Certificates.dll",
        "ref/netstandard1.3/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.3/de/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.3/es/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.3/fr/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.3/it/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.3/ja/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.3/ko/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.3/ru/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.3/zh-hans/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.3/zh-hant/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.dll",
        "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.4/de/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.4/es/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.4/fr/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.4/it/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.4/ja/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.4/ko/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.4/ru/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.4/zh-hans/System.Security.Cryptography.X509Certificates.xml",
        "ref/netstandard1.4/zh-hant/System.Security.Cryptography.X509Certificates.xml",
        "ref/xamarinios10/_._",
        "ref/xamarinmac20/_._",
        "ref/xamarintvos10/_._",
        "ref/xamarinwatchos10/_._",
        "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll",
        "runtimes/win/lib/net46/System.Security.Cryptography.X509Certificates.dll",
        "runtimes/win/lib/net461/System.Security.Cryptography.X509Certificates.dll",
        "runtimes/win/lib/netcore50/System.Security.Cryptography.X509Certificates.dll",
        "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll",
        "system.security.cryptography.x509certificates.4.3.0.nupkg.sha512",
        "system.security.cryptography.x509certificates.nuspec"
      ]
    }
  },
  "projectFileDependencyGroups": {
    "": [],
    ".NETFramework,Version=v4.6": [
      "Google.Apis >= 1.34.0"
    ]
  },
  "tools": {},
  "projectFileToolGroups": {},
  "packageFolders": {
    "D:\\home\\data\\Functions\\packages\\nuget": {}
  }
}

现在,当运行时,给定模板上的函数会出现编译错误:

2018-06-08T17:29:55.711 [Error] Function compilation error 2018-06-08T17:29:55.711 [Error] run.csx(8,19): error CS1929: 'HttpRequestMessage' does not contain a definition for 'GetQueryNameValuePairs' and the best extension method overload 'HttpRequestMessageExtensions.GetQueryNameValuePairs(HttpRequestMessage)' requires a receiver of type 'HttpRequestMessage' 2018-06-08T17:29:55.711 [Error] run.csx(15,30): error CS1929: 'HttpContent' does not contain a definition for 'ReadAsAsync' and the best extension method overload 'HttpContentExtensions.ReadAsAsync(HttpContent)' requires a receiver of type 'HttpContent' 2018-06-08T17:29:55.711 [Error] run.csx(20,11): error CS1929: 'HttpRequestMessage' does not contain a definition for 'CreateResponse' and the best extension method overload 'HttpRequestMessageExtensions.CreateResponse(HttpRequestMessage, HttpStatusCode, string)' requires a receiver of type 'HttpRequestMessage' 2018-06-08T17:29:55.711 [Error] run.csx(21,11): error CS1929: 'HttpRequestMessage' does not contain a definition for 'CreateResponse' and the best extension method overload 'HttpRequestMessageExtensions.CreateResponse(HttpRequestMessage, HttpStatusCode, string)' requires a receiver of type 'HttpRequestMessage' 2018-06-08T17:29:55.742 [Error] Exception while executing function: Functions.ganalytics. Microsoft.Azure.WebJobs.Script: Script compilation failed. 2018-06-08T17:29:55.742 [Error] Function completed (Failure, Id=bfbba2a8-6946-4935-8495-f21973d408cb, Duration=44ms)

据我所知,这是与 System.Net.Http 依赖项版本相关的问题,该版本以某种方式从 Google.Api 包中覆盖。 (link) 我要问的是:有解决方法来解决这个错误吗?

提前谢谢您。

最佳答案

要恢复此引用重定向,请转到 kudu 中的 D:\home\data\Functions\packages\nuget 文件夹,删除 system.net.http 包。然后重新启动整个功能应用程序以引用原始依赖项。

说明:

函数宿主引用GAC(全局程序集缓存)中的System.Net.Http.dll程序集。在本地,文件路径为 C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Http.dll 而在 Azure 上,它位于D:\...。它无法重定向到我们稍后使用 nuget 安装的某个包,否则我们会收到错误。

关于c# - System.Net.Http 依赖问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50765855/

相关文章:

c# - ASP.NET Core Web API 路由

azure - 在服务总线触发器中获取队列上消息的标签属性

c# - OrganizationWebProxyClient - 端点 = 地址 = 错误 CS0103 : The name '_address' does not exist in the current context, ClientCredentials

visual-studio - Azure Function 中的 ExecutionContext 不包含 'FunctionAppDirectory'

python - 将 Azure Functions 与 Python 结合使用 - Numpy 和 Pandas

c# - 在用户控件 wpf 中访问按钮的属性

c# - 在基类中定义一个返回自身名称的方法(使用反射)——子类继承此行为

c# - 启动时动态决定Winforms还是Wpf?

ASP.NET 数据缓存与 Azure Redis 缓存?

windows - 在 Windows Azure (VM) 上托管 dns 名称服务器