web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

ms crm 2013 web application hosted to local iis not working.

(0) ShareShare
ReportReport
Posted on by 1,077

Hi All,

I have created web application for survey purpose and setup this application to our local iis server. But it is giving error for system service model fault exception The server was unable to process the request due to internal error.

I used organization service to update data.

I want to know how can i consume crm service from hosted iis.

Thanks

*This post is locked for comments

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Could you please provide code that you use to update data?

  • Suresh Sorde Profile Picture
    1,077 on at

    Please check the code.

    string sUrl="http://test:5555/xyz";

    OrganizationServiceProxy sService = null;

    Uri sOrganizationuri = new Uri("" + sUrl + "/XRMServices/2011/Organization.svc");  

    ClientCredentials sCredentials = new ClientCredentials();

    sCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;

    sService = new OrganizationServiceProxy(sOrganizationuri, null, sCredentials, null);  

    sCaseId = Request.QueryString["incidentid"].ToString();

    sService = Service.GetService(sUrl);                    

    string strFetchIncident = @"<fetch mapping='logical' version='1.0'>" +

    " <entity name='incident'>" +

    "      <attribute name='new_caseno' />" +

    " <attribute name='title' />" +

    " <attribute name='customerid' />" +

    " <attribute name='new_customer' />" +                              

    " <attribute name='ownerid' />" +

    " <attribute name='incidentid' />" +

    " <filter type='and'>" +

    "           <condition attribute='statecode' value='0' operator='eq'/>" +

    "           <condition attribute='incidentid' operator='eq' value='" + sCaseId + "' />" +

    " </filter>" +

    " </entity>" +

    "</fetch>";

    ErrHander.WriteError("Entity Collection");​

    Log.WriteLog("Entity Collection");

    EntityCollection ecObjects = (EntityCollection)sService.RetrieveMultiple(new FetchExpression(strFetchIncident));                      

    if (ecObjects.Entities.Count > 0)

    {

    foreach (Entity ecObj in ecObjects.Entities)

    {

    if (ecObj.Attributes.Contains("incidentid"))

    {

    Guid gIncidentid = ecObj.GetAttributeValue<Guid>("incidentid");

    Log.WriteLog("Incident Id" + gIncidentid);

    string sIncidentid = gIncidentid.ToString();

    if (sIncidentid.ToLower().Trim() == sCaseId.ToLower().Trim())

    {

    hidIncidentId.Text = gIncidentid.ToString();

    if (ecObj.Attributes.Contains("customerid"))

    {

    EntityReference erAccountId = ecObj.GetAttributeValue<EntityReference>("customerid");

    Log.WriteLog("Account Id" + erAccountId.Id);

    Guid gAccountid = erAccountId.Id;

    txtCompanyName.Text = erAccountId.Name.ToString();

    hidAccountId.Text = erAccountId.Id.ToString();

    }

    if (ecObj.Attributes.Contains("ownerid"))

    {

    EntityReference erOwnerId = ecObj.GetAttributeValue<EntityReference>("ownerid");

    Guid gOwnerid = erOwnerId.Id;

    hidOwnerId.Text = erOwnerId.Id.ToString();

    }

    if (ecObj.Attributes.Contains("title"))

    {

    string sCaseTitle = ecObj.Attributes["title"].ToString();

    Log.WriteLog("Case Title" + sCaseTitle);

    hidCaseTitle.Text = sCaseTitle;

    }

    if (ecObj.Attributes.Contains("new_caseno"))

    {

    string sCaseno = ecObj.Attributes["new_caseno"].ToString();

    txtIncidentNumber.Text = sCaseno;

    }  

    }

    }

    }

    }

    protected void ibtnSubmit_Click(object sender, ImageClickEventArgs e)

    {

    sService =  Service.GetService(sUrl);            

    Entity entCaseFeedback = new Entity("new_casefeedback");

    if (txtIncidentNumber.Text != string.Empty)

    {

    entCaseFeedback["new_name"] = txtIncidentNumber.Text;

    }              

    Guid gAccountID = Guid.Empty;

    if (hidAccountId.Text != string.Empty)

    {

    gAccountID = new Guid(hidAccountId.Text);

    Log.WriteLog("Button click Account Id" + gAccountID);

    }

    Guid gCaseID = Guid.Empty;

    if (hidIncidentId.Text != string.Empty)

    {

    gCaseID = new Guid(hidIncidentId.Text);

    Log.WriteLog("Button click Case Id" + gCaseID);

    }

    Guid gOwnerID = Guid.Empty;

    if (hidOwnerId.Text != string.Empty)

    {

    gOwnerID = new Guid(hidOwnerId.Text);

    }

    entCaseFeedback["new_account"] = new EntityReference("account", gAccountID);

    entCaseFeedback["new_casetitle"] = new EntityReference("incident", gCaseID);

    entCaseFeedback["ownerid"] = new EntityReference("systemuser", gOwnerID);

    if (rbtnEasePoor.Checked == true)

    {

    entCaseFeedback["new_ease"] = new OptionSetValue(100000000);

    }

    else if (rbtnEaseBelowAverage.Checked == true)

    {

    entCaseFeedback["new_ease"] = new OptionSetValue(100000001);

    }

    else if (rbtnEaseAverage.Checked == true)

    {

    entCaseFeedback["new_ease"] = new OptionSetValue(100000002);

    }

    else if (rbtnEaseGood.Checked == true)

    {

    entCaseFeedback["new_ease"] = new OptionSetValue(100000003);

    }

    else if (rbtnEaseExcellent.Checked == true)

    {

    entCaseFeedback["new_ease"] = new OptionSetValue(100000004);

    }            

    entCaseFeedback["new_comments"] = txtComments.Text;

    sService.Create(entCaseFeedback);

    }

    Thanks

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Code looks good so far. To get explanation of an error try to turn remote errors - technet.microsoft.com/.../bb684665.aspx

    What error is shown?

  • Suggested answer
    Community Member Profile Picture
    on at

    use system.servicemodel and runtime serialisation dlls in ur namespace(c#) code kindly find the link : arunpotti.wordpress.com/.../connect-to-crm-online-or-on-premise-using-c

    to host on local server find this link:  www.c-sharpcorner.com/.../deploy-Asp-Net-website-on-iis-in-our-local-machine

    hope you get resolved with the issue......make verified if it resolves

    regards,

    Nithin

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans