0
我構建了一個使用一些API發送短消息的小型winform應用程序,當我在我的站點上運行它時,我的用戶一切都很好,但是如果我在我的站點上運行它,不同的用戶(改變用戶對exe文件SHIFT +鼠標右鍵):webRequest do not work from different user
using (Stream requestStream = restRequest.GetRequestStream())
拋出異常
沒有connectuion可以作出,因爲目標機器積極 拒絕我F(IP地址)
但是當我的應用程序複製到其他用戶站,並嘗試運行它,它的做工精細,準確地做同樣的我的用戶
的問題是,代碼應該是集成的應用程序使用已經WCF服務,將發送短信的和用戶服務器IIS中applicationpool拋出同樣的異常
什麼會是什麼?
我簡單的代碼:
JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
Dictionary<string, object> deserializedJsonDictionary;
HttpWebRequest restRequest;
WebResponse restResponse;
try
{
string connectionParams = "{some json params for api...}";
restRequest = (HttpWebRequest)WebRequest.Create(URI);
restRequest.Method = Method; //post
restRequest.ContentType = ContentType; // application/json
using (Stream requestStream = restRequest.GetRequestStream())
{
byte[] inputStringBytes = Encoding.UTF8.GetBytes(connectionParams);
requestStream.Write(inputStringBytes, 0, inputStringBytes.Length);
}
using (restResponse = restRequest.GetResponse())
{
using (Stream responseStream = restResponse.GetResponseStream())
{
StreamReader rdr = new StreamReader(responseStream, Encoding.UTF8);
string Json = rdr.ReadToEnd();
deserializedJsonDictionary = (Dictionary<string, object>)jsonSerializer.DeserializeObject(Json);
}
}
}
catch(Exception ex)
{
throw ex;
}
是頭不匹配,由於其拒絕連接?什麼是服務的認證/授權要求? – Amit
有一個用戶名和密碼,但它扔垃圾這之前獲取到服務器,以防一些參數是錯誤的服務器說的用戶名和密碼,我的意思是本地認證(API請求的返回JSON機智的所有信息 –
在這兩種情況下) –