Asked by:
Unable to connect to the remote server in crm 4.0?

Question
-
Unable to connect to the remote server at System.Net.HttpWebRequest.GetRequestStream()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at CRM_Service.CRM_Upload_WebService.CrmService.RetrieveMultiple(QueryBase query)
at CRM_Upload.CRM_Fetch()I am Trying to Connect to CRM4.0 but it gives me error that Unable to connect to the remote server
I am making windows service & from windows service it gives me error please Help
Thanks in Advance
Monday, July 25, 2011 2:46 PM
All replies
-
Monday, July 25, 2011 3:44 PMModerator
-
Thanks for reply
this is my code
CrmAuthenticationToken CRM_Token = new CrmAuthenticationToken();
CRM_Token.AuthenticationType = 0;
CRM_Token.OrganizationName = crmorgname;
CRMUpload.Url = crmlink;
CRMUpload.CrmAuthenticationTokenValue = CRM_Token;
//CRMUpload.Credentials = new System.Net.NetworkCredential(crmuser, crmpass, crmdomain);
CRMUpload.Credentials = System.Net.CredentialCache.DefaultCredentials;
CRMUpload.UnsafeAuthenticatedConnectionSharing = true;
List = new List();
ColumnSet Col = new ColumnSet();
Col.Attributes = new String[] { "pertyid","list"};
ConditionExpression condExp = new ConditionExpression();
condExp.AttributeName = "list";
condExp.Operator = ConditionOperator.Equal;
condExp.Values = new String[] { "true" };
FilterExpression filter = new FilterExpression();
filter.FilterOperator = LogicalOperator.And;
filter.Conditions = new ConditionExpression[] { condExp };
QueryExpression Query = new QueryExpression();
Query.EntityName = EntityName.perty.ToString();
Query.ColumnSet = Col;
Query.Criteria = filter;
BusinessEntityCollection ECollection = CRMUpload.RetrieveMultiple(Query);// I am Getting Error at this line
foreach (perty _Instance in ECollection.BusinessEntities)
{
string id = _Instance.pertyid.Value.ToString();
break;
}
Monday, July 25, 2011 4:35 PM -
Hi,
What is CRM Server Url are you passing (what is the value of crmlink) ? try use the URL in internet explorer and see if it is a valid URL.
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".Monday, July 25, 2011 4:49 PM -
Thanks for your reply
yes its valid i get xml file
Monday, July 25, 2011 5:06 PM -
Try to check with this code(from SDK),
replace Org name and Service URL
// Set up the CRM Service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
// You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0;
token.OrganizationName = "AdventureWorksCycle";
CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
Mahain : MS CRM Freelancer
Monday, July 25, 2011 5:28 PMModerator -
Thanks for reply but no luck not working same error
Any body please help its urgent
Tuesday, July 26, 2011 9:11 AM -
Hi,
Try passing credentials as mentioned below:
CRMUpload.Credentials = new System.Net.NetworkCredential(crmuser, crmpass, crmdomain);
Although bit more illogical but try creating RetrieveMultipleRequest and passing into crmService.Execute() instead of CrmService.RetrieveMultiple method (http://msdn.microsoft.com/en-us/library/bb929303.aspx)
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".- Edited by Jehanzeb.Javeed Tuesday, July 26, 2011 5:54 PM
Tuesday, July 26, 2011 9:25 AM -
Hi,
Try to catch details error
try
{
// your code
}
catch(SoapException error)
{
string Error=error.Detail.SelectSingleNode("//description").InnerText);
}
Mahain : MS CRM FreelancerTuesday, July 26, 2011 10:02 AMModerator -
Mahender Pal its Exception not an Soap Exception so i can't even write thisTuesday, July 26, 2011 10:38 AM
-
see all my main issue is it works fine when i m using windows application
but it gives me issue when i m creating a windows service with same code so please let me knw what is the steps or how to create a windows service in C#.net & then i have created a setup for windows service & after that i am starting my service from start-> run-> services.msc
it gives me list of services from that i select the my service & click on start but it gives me error for crm unable to connect
let me know where i am wrong
Thanks in advance
- Edited by krunal89 Wednesday, July 27, 2011 10:47 AM
Tuesday, July 26, 2011 10:43 AM -
any body please help????????Wednesday, July 27, 2011 10:24 AM
-
Hi,
check this post http://www.stunnware.com/crm2/topic.aspx?id=crmwindowsservice1
Mahain : MS CRM FreelancerWednesday, July 27, 2011 11:31 AMModerator