我有一个使用RestSharp和Newtonsoft登录的代码。Json包。此代码如下所示:
Dim client = New RestClient("https://api.mysite.com/auth/login")
Dim request = New RestRequest(Method.POST)
request.AddHeader("authentication-key", "123")
request.AddHeader("authentication-id", "123")
request.AddParameter("application/x-www-form-urlencoded", "username=123&password=123", ParameterType.RequestBody)
Dim response As RestResponse = client.Execute(request)
MsgBox(response.Content.ToString)
If response.StatusCode.ToString = "OK" Then
'Save token
Dim result = JsonConvert.DeserializeObject(response.Content.ToString)
End If
当我在Visual Studio中运行此代码时,它是有效的。但当我为windows发布它时,MsgBox中没有响应。当我在我的计算机(安装的visual studio)中运行已发布的程序时,它可以工作并显示服务器的响应,但当我在其他计算机中运行已发布的代码时,响应为null。请帮帮我。