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)

Problem calling a web service that connects to CRM

(0) ShareShare
ReportReport
Posted on by 925

Hello,

I have a web service published in IIS that has calls to a CRM site.

When browsing on the IIS Site, I can view all the functions without any issue.

However, when calling any functions that makes calls to the CRM site, it doesn't recognize the connectionsetting statement I have in the Web.config file.

Here's what the web.config file looks like on the web service website:

<?xml version="1.0"?>

<configuration>

<appSettings/>

 <connectionStrings>

   <add name="CRM_URL" connectionString="Url=http://k-crm-dev-web01/Kitco"/>

 </connectionStrings>

<system.web>

<trace enabled="true" pageOutput="false" requestLimit="40" localOnly="false"/>

<compilation debug="true" targetFramework="4.0">

</compilation>

<!--

     The <authentication> section enables configuration

     of the security authentication mode used by

     ASP.NET to identify an incoming user.

   -->

<authentication mode="Windows"/>

<!--

      The <customErrors> section enables configuration

      of what to do if/when an unhandled error occurs

      during the execution of a request. Specifically,

      it enables developers to configure html error pages

      to be displayed in place of a error stack trace.

      <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">

        <error statusCode="403" redirect="NoAccess.htm" />

        <error statusCode="404" redirect="FileNotFound.htm" />

      </customErrors>

   -->

<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>

<!--

       The system.webServer section is required for running ASP.NET AJAX under Internet

       Information Services 7.0.  It is not necessary for previous version of IIS.

   -->

<system.serviceModel>

 <behaviors>

  <serviceBehaviors>

   <behavior name="">

    <serviceMetadata httpGetEnabled="true" />

    <serviceDebug includeExceptionDetailInFaults="true" />

   </behavior>

  </serviceBehaviors>

 </behaviors>

 <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

</system.serviceModel>

</configuration>

Any clue?

Thanks in advance,

J-P

*This post is locked for comments

I have the same question (0)
  • Verified answer
    ScottDurow Profile Picture
    21 on at

    Hi,

    Are you using the SDK Connection API described here - msdn.microsoft.com/.../jj602970.aspx

    It could be that you haven't specified any credentials and the identity that IIS is running under doesn't have access to CRM. You may need to specify a username/password in your connection string.

    Hope this helps,

    Scott

  • Kitco Profile Picture
    925 on at

    Currently, our CRM site has users based on Active Directory.

    Which user (network user) should be created in CRM and how would it reflect in the web.config file?

    Here's an excerpt from my web service in Visual Studio:

    // Establish a connection to the organization web service using CrmConnection.

    Microsoft.Xrm.Client.CrmConnection connection = CrmConnection.Parse(ConfigurationManager.ConnectionStrings["CRM_URL"].ConnectionString);

    I get an error because it doesn't recocgnize the connection string CRM_URL.

    Thanks in advance.

  • Verified answer
    ScottDurow Profile Picture
    21 on at

    Hi,

    To instantiate a connection use:

    var connection = new CrmConnection("CRM_URL");

    var service = new OrganizationService(connection);

    See my post on this - develop1.net/.../Microsoft-Xrm-Client-(Part-3b)-Configuration-via-appwebconfig.aspx

    If you are running the IIS Application under Network Services, you will either need to change the identity to a CRM user - or add a user name/password to the connection string - e.g.

    Url=http://k-crm-dev-web01/Kitco; Domain=<domain>; Username=<username>; Password=<password>;

    Hope this helps,

    Scott

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