Month: October 2014

MVC HTMLHelper Error

While starting with MVC one of the most basic error encountered is the one where using reference is missed for HTMLHelper class.

Below is the example of typical error.

System.Web.Mvc.HtmlHelper has no applicable method named ‘TextBox’ but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.

To resolve this error you need to make sure you have added the namespace reference for “System.Web.Mvc.Html” to your files.

Where all that name space reference should be:

1. Web.Config of your Area. “<add namespace=”System.Web.Mvc.Html” />”

2.  View Page. “<%@ Import Namespace=”System.Web.Mvc.Html” %>”

3. Controller. “using System.Web.Mvc.Html;”

 

Attribute *** is a String, but a Memo type was specified.

Another error of the Day:

“Attribute *** is a String, but a Memo type was specified.”

While importing solution we got given error. This error signifies that the data type of Attribute mentioned on the given entity has been changed and CRM does not permit that.

Only solution for this problem is to delete the attribute.

If this is in a production system then you are in for a whole lot of work as you will have keep the data in some other field/flat file mapped to the record and re-import data so that there is no data loss.

 

OptionSetId cannot be changed. EnumAttributeInfo.AttributeDescription.OptionSetId

In CRM 2011, While merging some customization we were getting error  that OptionSetId Can not be changed. 

OptionSetId cannot be changed. EnumAttributeInfo.AttributeDescription.OptionSetId(2806db8c-368a-42d5-8cdd-b3d3538580de) != ab8567b8-9e4e-e411-af60-080027314af2

 

  1. For Fixing error first we need to find the optionset that’s changed. (In SQL Server Management studio run “select name from optionsetview where optionsetid = ‘ab8567b8-9e4e-e411-af60-080027314af2” where highlighted part is second guid in error)
  2. Remove dependencies in CRM like field on form, views and then delete optionset field.
  3. Re-import solution.

This I had to do couple of times as there were multiple optionsets that were deleted and recreated.

Thanks to Becky Cote for the solution.

Import Unmanaged Solution error OptionSetId cannot be changed.

Windows could not start the iis admin service on local computer

While restarting IIS I was getting following error

“The IIS Admin Service or the World Wide Web Publishing Service, or a service dependent on them failed to start.  The service, or dependent services, may had an error during its startup or may be disabled.”

Went to services.msc and tries starting “IIS Admin Service” and got following error:

“windows could not start the iis admin service on local computer”

“Specified file could not be found”.

To resolve this I followed given msdn blog.

Steps:

1. Went to “C:WINDOWSsystem32inetsrv”, “MetaBase.xml” was missing

2. Went to History Folder “C:WINDOWSsystem32inetsrvHistory”.

3. Backed up the latest file and renamed it to “MetaBase.xml”.

4. Pasted file in “C:WINDOWSsystem32inetsrv”.

5. Went to Services.msc and started “IIS Admin Service” and it worked 🙂