3
votes

We have just upgraded from Microsoft Dynamics CRM 4 to Microsoft Dynamics CRM 2011. Most of the upgrade has gone smoothly, however I have some custom code (written for CRM 4) which was implemented as an ASPX page in the CRM 4 ISV folder. This code has stopped working since the upgrade.

Our Dynamics CRM 2011 server is set up On Premise, as an IFD deployment.

The code connects to the CRM Server as follows:

using (new CrmImpersonator())
         {
             string crmurl = "https://<server>:444/<org>/mscrmservices/2007/CrmService.asmx";
             string orgname = <org>;

             CrmAuthenticationToken token = CrmAuthenticationToken.ExtractCrmAuthenticationToken(context, orgname);
             token.OrganizationName = orgname;

             token.AuthenticationType = 0;

             CrmService service = new CrmService();
             service.Credentials = System.Net.CredentialCache.DefaultCredentials;
             service.CrmAuthenticationTokenValue = token;
             service.Url = crmurl;

             WhoAmIRequest who = new WhoAmIRequest();
             WhoAmIResponse whoResponse = (WhoAmIResponse)service.Execute(who);

Upon sending the WhoAmIRequest I receive the following exception:

The request failed with the error message:
--
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="https://<server>:444/<org>/mscrmservices/2007/CrmService.asmx">here</a>.</h2>
</body></html>

--.

at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Microsoft.Crm.SdkTypeProxy.CrmService.Execute(Request Request)
at ForecastConverterWeb.CashflowForecast.ToCrm(HttpContext context)
at ForecastConverterWeb._Default.submitbtn_click(Object sender, EventArgs e)

It seems that when the code tries to send the request to https://:444//mscrmservices/2007/CrmService.asmx the page returns a link to redirect to, well... itself (https://:444//mscrmservices/2007/CrmService.asmx).

I've tried using the internal address (port 5555), external IFD address (https over port 444) and internal IFD (https over port 444) address all with the same result. I know that in CRM 2011 ISV is being depreciated, but the considering the amount of time it would take to re-develop this software (and the fact that considering it's supported code, I shouldn't have to) I'd rather just get this working as it should (according to this: http://msdn.microsoft.com/en-us/library/gg309571.aspx)

I'm grateful in advance for any help anyone can offer.

1

1 Answers

3
votes

Your code makes it look like you put the organization name between the host and the path to the /2007/crmservice.asmx. Don't do that. I know you have to prepend the organization name when on-premise to custom aspx/asmx files in the ISV directory, but as far as I've ever tried it doesn't work for crmservice.asmx.