Xamarin.Mac https:// localhost httplclient

问题描述 投票:0回答:1

我有一个本地webapi,我使用自签名证书在PC上运行。我可以使用浏览器(https://localhost:port/controller/method)访问webapi(以.net内核编写),但是在Mac OS上使用httpclient时莫哈维(Mojave)我例外(High Sierra和Catalina作品)。

System.DllNotFoundException: libc.dylib assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) System.Net.NetworkInformation.CommonUnixIPGlobalProperties.getdomainname(byte[],int)
  at System.Net.NetworkInformation.CommonUnixIPGlobalProperties.get_DomainName () [0x0000b] in <4b9a7f543fd447a3be5e54f34ee219b2>:0 
  at System.Net.CookieContainer..ctor () [0x0003f] in <4b9a7f543fd447a3be5e54f34ee219b2>:0 
  at System.Net.Http.MonoWebRequestHandler.get_CookieContainer () [0x0000a] in <e45d721af82a41d98156aeda80e9ce53>:0 
  at System.Net.Http.MonoWebRequestHandler.CreateWebRequest (System.Net.Http.HttpRequestMessage request) [0x000f5] in <e45d721af82a41d98156aeda80e9ce53>:0 
  at System.Net.Http.MonoWebRequestHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x0003e] in <e45d721af82a41d98156aeda80e9ce53>:0 
  at System.Net.Http.HttpClient.SendAsyncWorker (System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) [0x000e8] in <e45d721af82a41d98156aeda80e9ce53>:0 
  at Mac_Installer.ViewController.Timer_Elapsed (System.Object sender, System.Timers.ElapsedEventArgs e) [0x000bd] in <3581d802103c47bbbf47f26a2763b24c>:0

我已经阅读了,看来我需要将DYLD_FALLBACK_LIBRARY_PATH设置为/ usr / lib(我可以看到文件-libc.dylib-在那里),相信我应该在其中添加它info.plist作为环境变量,但是仍然失败,或者我做错了。

得到任何帮助。

.net-core localhost macos-mojave self-signed xamarin.mac
1个回答
0
投票

如果启用了强化的运行时,请尝试将“允许DYLD环境变量权利”(com.apple.security.cs.allow-dyld-environment-variables)添加到Entitlements.plist中。

© www.soinside.com 2019 - 2024. All rights reserved.