Mark Rhodes

A blog by Mark Rhodes for Sharepoint and CRM and occasionally other stuff too!

Add to Technorati Favorites

Error while publishing CRM 4.0 Workflow

I have seen this error three times now, the first time I made a recommendation to contact Microsoft Premier Support, the second time I worked it out, and this third time I decided it was worth blogging about.

The error is very simply when you attempt to publish a workflow you receive a rather unhelpful "The workflow cannot be published" such as the picture below.  This behavior seems to occur straight after applying an Update Rollup, however seems to occur far more frequently after Update Rollup 3 and 4.

Workflow Error

The following more helpful error is recorded in the Event Log :

Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 6/19/2009 10:53:10 AM
Event time (UTC): 6/19/2009 12:53:10 AM
Event ID: 63e4987779424d0b8eb93fca2566a7cf
Event sequence: 13175
Event occurrence: 6
Event detail code: 0
 
Application information:
    Application domain: /LM/W3SVC/1/ROOT-1-128897723456212507
    Trust level: Full
    Application Virtual Path: /
    Application Path: c:\inetpub\wwwroot\
    Machine name: XXXXXXX
 
Process information:
    Process ID: 9116
    Process name: w3wp.exe
    Account name: NT AUTHORITY\NETWORK SERVICE
 
Exception information:
    Exception type: TargetInvocationException
    Exception message: Exception has been thrown by the target of an invocation.
 
Request information:
    Request URL: http://CRM/CRM/_grid/cmds/dlg_activate.aspx?iObjType=4703&iTotal=1&iIndex=0&iId={FC6EF8AE-96F6-427B-9F21-24E9A7E9E85B}
    Request path: /CRM/_grid/cmds/dlg_activate.aspx
    User host address: 10.3.0.146
    User: Username
    Is authenticated: True
    Authentication Type: Negotiate
    Thread account name: NT AUTHORITY\NETWORK SERVICE
 
Thread information:
    Thread ID: 1
    Thread account name: NT AUTHORITY\NETWORK SERVICE
    Is impersonating: False
    Stack trace:    at Microsoft.Crm.Application.Utility.Util.RaiseXMLError(Exception exception)
   at Microsoft.Crm.Dialogs.ActivateDialogPage.ConfigureForm()
   at Microsoft.Crm.Application.Controls.AppUIPage.OnPreRender(EventArgs e)
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

After much digging and poking I finally tried comparing the web.config file of the CRM server experiencing this error to another server which had not yet had an update rollup done, and immediately I noticed a major difference.  There were four lines missing from the AuthorizedTypes section of the config file!

Missing from Auth Types

 Immediately I took a backup of the existing web.config and then added those four lines in, Bingo!  Immediately I was able to publish workflows.  From a bit of research I did after finding this I was able to find out that this problem was thought to be resolved post Update Rollup 2, however judging from these results this is not the case.  Not so easy to find, but very easy to fix.  My suspicion is that the error will only show up when the web.config was previously modified after the initial installation of CRM, which would explain why we are seeing this semi-frequently on hosting environments, especially the ones with a large amount of customizations.

The four lines I applied into the web.config follow :

      <authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System"  TypeName="Void" Authorized="True"/>
      <authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.Reflection"  TypeName="AssemblyFileVersionAttribute" Authorized="True"/>
      <authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.Reflection"  TypeName="AssemblyVersionAttribute" Authorized="True"/>
      <authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.Globalization" TypeName="CultureInfo" Authorized="True"/>

Comments

Mark_Walczak said:

Hey Mark:

Big Fan....and thank you for the great post! You saved me a couple hours of research and potentially a head-ache. I ran into a similar issue as you described above the other day.  The only difference I determined was that the environment in which I was seeing this happen in was slightly different.  Their are no Roll-Up's applied, and only two of the four lines of code were missing. I added the two lines to the Web.Config, IISRESET, and we were back to Publishing Workflows!

Thanks!

- Mark Walczak

# July 10, 2009 11:24 PM

Work, You Stupid Thing » MS CRM 4.0 Unable to Publish Workflows said:

Pingback from  Work, You Stupid Thing &raquo; MS CRM 4.0 Unable to Publish Workflows

# October 12, 2009 3:30 PM

setras said:

Thank you Mark.  Great post! Saved me a few hours today.  

# November 5, 2009 4:44 AM

HMS said:

Thank you!  Saved me a couple hours as well.

# November 12, 2009 7:30 AM

apfrehm said:

I have a theory on this, and let me start by saying that this is a mostly uneducated guess based upon semi-related information I have learned from others:

Today I experienced the same issue, and the only missing line was the System.Globalization line.  While this was similar to what you reported, I have not installed any updates recently.  That being said, making the changes fixed it.  An IISReset alone would not.  This got me thinking back to what a coworker once suggested about IISReset, how clearing out the temporary files wouldn't always happen, but making even the smallest change to web.config would.  Is this really an issue of those references being missing, or is this just purging out some bad data from temporary files / cache?

Again, I know barely anything about IIS, just something I thought of based upon second-hand information.

# December 15, 2009 8:37 AM

Mark Rhodes said:

Hi Apfrehm,

In theory both a IIS Reset and a modification to the web.config should trigger a JIT (Just In Time) Compile.

I think the temporary files should only be regenerated upon an IIS Reset, not the web.config changes.  I've seen a few scripts out there that stop iis, then delete all temporary files, then start it up again.  Maybe this is what you are after?

Mark

# December 15, 2009 11:13 PM

apfrehm said:

Recompiling, that was it.  That's what was necessary for my workflow to publish.  I'm not entirely sure what happened to cause it to fail in the first place, however the recompiling worked.

What I would still need to try is removing the line from web.config that I had added, running IIS Reset again, and testing to see if I could still publish workflows.  If that's the case, then I guess something just compiled incorrectly at one point and needed to be recompiled.

# December 16, 2009 3:12 AM

KenJ said:

Thanks for the article Mark. It saved us a lot of time. We are at UR2 and moving to UR8 this week. The problem showed up as soon as we put UR8 on our test system. We were only missing the last line (CultureInfo) but that was enough to trigger the problem for us in moving past UR2. Adding the missing line and iisreset fixed it immediately. Thanks again for blogging about it.

# January 27, 2010 2:51 AM

fgalarraga said:

Thanks for the article!  Had the same issues, even moved up to Rollup 9 and I still had to add the "CultureInfo" to web.config to fix the problem. Could this only be an issue if you have multiple MUI installed? Thanks for blogging about this, saved me hours of work!

# March 3, 2010 8:48 AM