Добрый день?
Пишу тест приложение, получающее данные из MS CRM 3.0
например вот так:
X++:
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.Url = "http://crm:5555/mscrmservices/2006/crmservice.asmx";
opportunity crmOpportunity = new opportunity();
Guid custAccountGuid = new Guid("F4D00C90-89C9-DA11-86AF-000BDB5C46AB");
crmOpportunity.customerid = new Customer();
crmOpportunity.customerid.Value = custAccountGuid;
crmOpportunity.customerid.type = EntityName.account.ToString();
crmOpportunity.opportunityratingcode = new Picklist();
crmOpportunity.opportunityratingcode.Value = 2;
crmOpportunityId = service.Create(crmOpportunity);
Guid crmOpportunityId;
то пример работает, а если выполнить запрос, например вот так
X++:
string fetch1 = "<fetch mapping='logical'>";
fetch1 += "<entity name='account'><all-attributes/>";
fetch1 += "</entity></fetch>";
String result1 = service.Fetch(fetch1);
то падает с ошибкой
"The underlying connection was closed: The connection was closed unexpectedly."
" at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)\r\n at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)\r\n at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)\r\n at TestConsoleApplication.crmservice.CrmService.RetrieveMultiple(QueryBase query) in C:\\Documents and Settings\\Administrator\\My Documents\\Visual Studio 2008\\Projects\\TestConsoleApplication\\TestConsoleApplication\\Web References\\crmservice\\Reference.cs:line 281\r\n at TestConsoleApplication.Program.Main(String[] args) in C:\\Documents and Settings\\Administrator\\My Documents\\Visual Studio 2008\\Projects\\TestConsoleApplication\\TestConsoleApplication\\Program.cs:line 46\r\n at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Threading.ThreadHelper.ThreadStart()"