我们正在使用HttpClient将json发布到一个宁静的Web服务.在一个例子中,我们遇到了困扰我们的事情.使用postman,fiddler等工具,我们可以发布到端点并看到它正在工作.当我们对HttpClient.PostAsJsonAsync做同样的事情时,我们可以在我们发布的软件中验证它收到的数据就好了.但是,我们的PostAsJsonAsync总是最终超时,而不是给我们一个响应.
我们与创建我们正在消费的服务的团队合作,加上我们的额外测试,我们还没有真正超时的服务.
每次我们使用HttpClient发布帖子时,我们都可以验证我们发布的目标软件是否确实获得了数据.每当我们从任何其他工具发布到目标软件的帖子时,我们总是很快看到状态代码为200的响应.关于HttpClient的某些内容未能接受来自此特定服务的响应.有没有人知道我们可以从这里看到什么?
这是代码(虽然它是如此千篇一律,我几乎觉得不需要)
public string PostData(string resourcePath, Object o, Boolean isCompleteUrl = false, int timeoutMinutes = -1)
{
using (var client = new HttpClient())
{
if (timeoutMinutes > 0)
{
client.Timeout = new TimeSpan(0,timeoutMinutes,0);
}
var useUrl = isCompleteUrl ? resourcePath : ApiBase + resourcePath;
var response = client.PostAsJsonAsync(useUrl, o).Result;
if(response.StatusCode == System.Net.HttpStatusCode.OK)
{
return response.Content.ReadAsStringAsync().Result;
}
return "";
}
}
Run Code Online (Sandbox Code Playgroud) 我只是在尝试使用photoswipe,到目前为止,我还没有做过比简单实现一些非常小的(和理论上微不足道的调整)的入门演示副本更先进的东西.
我的图片库很好,我总共有4个项目,因为我只是想测试它.第一张照片将变焦和平移,所有这些都很棒.但是,当我切换图片时,我在这个帖子标题中得到了javascript错误.
我使用以下作为我的项目:
var items =[{"src":"/Images/Portfolio/Pieces/PhoenixFury.jpg","thumbnail":"/Images/Portfolio/Thumbs/PhoenixFury.jpg","msrc":"/Images/Portfolio/Thumbs/PhoenixFury.jpg","w":765,"h":1201,"title":"Phoenix\u0027s Fury","caption":"Illustration used for the cover of Lifeweaver","key":"Phoenix"},{"src":"/Images/Portfolio/Pieces/EnoreTower.jpg","thumbnail":"/Images/Portfolio/Thumbs/EnoreTower.jpg","msrc":"/Images/Portfolio/Thumbs/EnoreTower.jpg","w":765,"h":1200,"title":"Enore\u0027s Tower","caption":"Illustration used for the cover of Guardian\u0027s Peril","key":"Enore"},{"src":"/Images/Portfolio/Pieces/KenpoLogo.jpg","thumbnail":"/Images/Portfolio/Thumbs/KenpoLogo.jpg","msrc":"/Images/Portfolio/Thumbs/KenpoLogo.jpg","w":800,"h":966,"title":"Kenpo Karate Logo","caption":"Commissioned karate team logo for a team in Mexico with central american themes on the traditional Kenpo notion of a dragon and a tiger.","key":"Kenpo"},{"src":"/Images/Portfolio/Pieces/Quetzalcoatl.jpg","thumbnail":"/Images/Portfolio/Thumbs/Quetzalcoatl.jpg","msrc":"/Images/Portfolio/Thumbs/Quetzalcoatl.jpg","w":1600,"h":967,"title":"Quetzalcoatl","caption":"Central American ancient deity Quetzalcoatl, the feathered serpent.","key":"Quetzalcoatl"}];
Run Code Online (Sandbox Code Playgroud)
我添加了一些自定义属性,但我还没有对photoswipe做任何事情来尝试利用它们,所以我不认为这是问题所在.
我使用以下作为我的选择:
var options = {
history: false,
focus: false,
index: 0,//I can verify that 0,1,2,3 all load up correctly for an initial load
showAnimationDuration: 0,
hideAnimationDuration: …
Run Code Online (Sandbox Code Playgroud)