locked
Workflow triggered plugin - cannot find web.config values RRS feed

  • Question

  • We have a working solution where a plugin executes on post update of a product (custom entity new_product). The plugin call a wcf service for some information and works well.

    However, when we now have created a workflow, triggered by create on the product (where we set some initial values). We get "Could not find default endpoint element that references contract 'xxx' in the ServiceModel client configuration section."

    It seems like the plugin cannot access the wcf client configuration when "triggered by a workflow"

    When debugging I can see that the plugin is actually executed by the async process. A reasonable explanation is probably that the async process cannot access web.config. Does anyone have an easy way around this?

    Monday, January 14, 2013 11:02 AM

Answers

  • Hello,

    Check this.


    Contact Me
    Follow me on Twitter
    My Facebook Page
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    • Marked as answer by Adamber Tuesday, January 15, 2013 7:44 AM
    Monday, January 14, 2013 11:11 AM
    Moderator
  • While there are fixes for specific CRM issues described in support articles (such as Web Service timeouts), I don't think the intention is to extend support for ad-hoc modifications of the web.config for the purposes of web client connectivity.

    I don't think that you should "assume" anything about the underlying mechanisms available to a plugin, such as the existence or otherwise, or configurability of the web.config.  As you have discovered, the triggering of the plugin via a Workflow, or the configuration of the plugin as Asynchronous cause it to be execute by the Asynchronous Service.

    In addition to the issues you are currently encountering:

    1. Microsoft could change the implementation of any of these mechanisms at any time causing your code to break without warning
    2. You are removing the implementation of your solution from with the CRM (that is, installing components outside of the database) which causes potential migration issues

    It would be better to configure your WCF Service client in code.  If you require parameterisation, pass such information in via the Plugin constructor or use a Custom Entity to store configuration data.


    --pogo (pat) @ pogo69.wordpress.com

    • Marked as answer by Adamber Tuesday, January 15, 2013 7:44 AM
    Monday, January 14, 2013 11:12 PM

All replies

  • Hello,

    Check this.


    Contact Me
    Follow me on Twitter
    My Facebook Page
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    • Marked as answer by Adamber Tuesday, January 15, 2013 7:44 AM
    Monday, January 14, 2013 11:11 AM
    Moderator
  • Can you tell me if this is supported, edit the web.config in order to provide configuration information?
    Monday, January 14, 2013 12:22 PM
  • I have seen KB articles where Microsoft has suggested to do changes in webconfig file configuration so I think it should be supported, but make sure to keep backup copy of your existing webconfig file.

    Contact Me
    Follow me on Twitter
    My Facebook Page
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Monday, January 14, 2013 3:07 PM
    Moderator
  • While there are fixes for specific CRM issues described in support articles (such as Web Service timeouts), I don't think the intention is to extend support for ad-hoc modifications of the web.config for the purposes of web client connectivity.

    I don't think that you should "assume" anything about the underlying mechanisms available to a plugin, such as the existence or otherwise, or configurability of the web.config.  As you have discovered, the triggering of the plugin via a Workflow, or the configuration of the plugin as Asynchronous cause it to be execute by the Asynchronous Service.

    In addition to the issues you are currently encountering:

    1. Microsoft could change the implementation of any of these mechanisms at any time causing your code to break without warning
    2. You are removing the implementation of your solution from with the CRM (that is, installing components outside of the database) which causes potential migration issues

    It would be better to configure your WCF Service client in code.  If you require parameterisation, pass such information in via the Plugin constructor or use a Custom Entity to store configuration data.


    --pogo (pat) @ pogo69.wordpress.com

    • Marked as answer by Adamber Tuesday, January 15, 2013 7:44 AM
    Monday, January 14, 2013 11:12 PM
  • Hi,I am agree with pogo that your changes can be overwritten when you will install any update rollup, although it is not documented in SDK but I don't see any issue in changing webconfig file to store configuration information.

    Contact Me
    Follow me on Twitter
    My Facebook Page
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.


    Tuesday, January 15, 2013 1:42 AM
    Moderator