プラグインでPostUpdateでHTTP Postを実行しようとすると問題が発生します。あなたがC#の-codeを持っているの下に、私はここで... - エラー「操作がタイムアウトした」CRM 2011 - プラグイン - プラグインでHTTP Postを実行しようとすると操作のタイムアウトエラーが発生する
を取得しています:
//PUBLISH TO ROBAROV
WebRequest webRequest = WebRequest.Create(newUri);
webRequest.Timeout = 2000;
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.Method = "POST";
byte[] bytes = Encoding.ASCII.GetBytes(parameters);
Stream os = null;
try
{
webRequest.ContentLength = bytes.Length;
os = webRequest.GetRequestStream();
os.Write(bytes, 0, bytes.Length);
}
catch (WebException ex)
{
throw new Exception(ex.Message);
}
finally
{
if (os != null)
{
os.Close();
}
}
//ERROR HAPPENS HERE
string responseText = "";
try
{ // get the response
WebResponse webResponse = webRequest.GetResponse();
StreamReader sr = new StreamReader(webResponse.GetResponseStream());
responseText = sr.ReadToEnd().Trim();
}
catch (WebException ex)
{
throw new Exception("Error with response : " + ex.Message);
}
私は応答を取得しようとしているときにエラーが発生し
= > webRequest.GetResponse();!
シンプルな「クラス」ライブラリでコードを試してみましたが、そこには魅力的な機能があります。私が間違っていることはありますか? HTTPポストは、同じドメインにないウェブページにある....
UPDATE: 私はWebクライアントで次の手順を実行したときに同じことが起こる...そして、それは通常の「コンソール」-applicationに動作します:
private string HttpPostTest(string URL)
{
WebClient webClient = new WebClient();
System.Collections.Specialized.NameValueCollection formData = new System.Collections.Specialized.NameValueCollection();
formData["state"] = "yes";
byte[] responseBytes = webClient.UploadValues(URL, "POST", formData);
string Result = Encoding.UTF8.GetString(responseBytes);
return Result;
}
私は、「イベントビューア」に次のエラーを取得しています:
Inner Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Crm.Setup.DiffBuilder, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.