2017-03-03 1 views
0

XML 응답을 얻으려고하는 플러그인을 작성했습니다. 이 내 코드입니다 : 자사의 콘솔 응용 프로그램으로 작성된 경우HttpWebRequest.GetRequestStream()이 MS Dynamics CRM Plugin에서 작동하지 않습니다.

// Set the Method property of the request to POST. 
string strXMLServer = "xxx"; 
var request = (HttpWebRequest)WebRequest.Create(strXMLServer); 
request.Method = "POST"; 

// Set the ContentType property of the WebRequest. 
request.ContentType = "xyz"; 

// Assuming XML is stored in strXML 
byte[] byteArray = Encoding.UTF8.GetBytes(strXML); 

// Set the ContentLength property of the WebRequest. 
request.ContentLength = byteArray.Length; 

//(LINE 5) Get the request stream 
Stream dataStream = request.GetRequestStream(); 

// Write the data to the request stream. 
dataStream.Write(byteArray, 0, byteArray.Length); 
// Close the Stream object. 
dataStream.Close(); 

이 코드는 잘 작동합니다. 내가 클래스 라이브러리 (플러그인) 같은 코드를 복사하여 플러그인 프로파일 러를 사용하여 디버깅하려고 할 때, 응용 프로그램이 갑자기 중단 도착이 도달하면 (LINE 5) 즉 Stream dataStream = request.GetRequestStream();

request.GetRequestStream에서() 함수가 플러그인과 함께 작동하지 않지만 콘솔 내에서 올바르게 작동합니다.

어떤 도움을 주시면 감사하겠습니다 :) 사전에

감사를

참고 : 나는

답변

0

가 고려해야 할 몇 가지가 있습니다 온라인 평가판 역학 365을 사용하고 있습니다 웹 요청으로 플러그인을 만들 때. 첫째, WebClient을 Microsoft 제품에서 널리 지원되는 것을 사용해야합니다. 이 샌드 박스 모드에서 호스팅 플러그인이기 때문에

둘째, 당신의 URL은 DNS 이름 아닌 IP 주소가 있어야합니다.

마이크로 소프트의 웹 사이트에서

예 : https://msdn.microsoft.com/en-us/library/gg509030.aspx

읽기 자료 : https://crmbusiness.wordpress.com/2015/02/05/understanding-plugin-sandbox-mode/

관련 문제