小编Maa*_*ten的帖子

将HttpClient转换为RestSharp

我有Httpclient函数,我试图转换为RestSharp但我面临一个问题,我无法解决使用谷歌.

client.BaseAddress = new Uri("http://place.holder.nl/");
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer",access_token);
HttpResponseMessage response = await client.GetAsync("api/personeel/myID");
string resultJson = response.Content.ReadAsStringAsync().Result;
Run Code Online (Sandbox Code Playgroud)

这个代码在我的HttpClient代码中,它运行良好,但是我无法在RestSharp中使用它,我在使用RestSharp时总是未经授权:

RestClient client = new RestClient("http://place.holder.nl");
RestRequest request = new RestRequest();
client.Authenticator = new HttpBasicAuthenticator("Bearer", access_token);
request.AddHeader("Accept", "application/json");
request.Resource = "api/personeel/myID";
request.RequestFormat = DataFormat.Json;
var response = client.Execute(request);
Run Code Online (Sandbox Code Playgroud)

我错过了认证的东西吗?

c# restsharp asp.net-web-api xamarin

7
推荐指数
2
解决办法
1万
查看次数

错误 MT1006 容器创建失败

我试图在我购买的物理 iPhone 4s 上调试我的应用程序。iphone 完全是空的,我做了启动配置,仅此而已。我的 VS2015 连接到我的 Mac 构建主机,其中也连接了 iPhone 4s。据我所知,证书已安装且正确。iPhone 在 VS2015 中作为调试设备出现

运行 10.10.5 (Yosemite) 和 Xcode 和 Xamarin Studio 的 Macbook Pro。Windows 8.1 安装在该 Mac 上的 VM 上,带有 VS2015 和整个 Xamarin 包。

完整的错误是:

error MT1006: 
Could not install the application '/Users/*placeholder*/Library/Caches/Xamarin/mtbs/builds/*placeholder*/*placeholder*/bin/iPhone/Debug/*placeholder*.app' on the device iPhone van *placeholder*: Container Creation Failed Error (error: 0xe8000041).
Run Code Online (Sandbox Code Playgroud)

我用占位符替换了一些个人详细信息

在 Mac 上使用 Xamarin Studio 构建时,使用 VS2015 构建时也会出现此错误

我找不到有关如何解决此问题的信息,所以我希望人们可以帮助我。

马丁

iphone macos xamarin.ios ios xamarin

2
推荐指数
1
解决办法
8395
查看次数

标签 统计

xamarin ×2

asp.net-web-api ×1

c# ×1

ios ×1

iphone ×1

macos ×1

restsharp ×1

xamarin.ios ×1