"web.config cannot be changed" when trying to enable ORM for a project.

3 posts, 1 answers
  1. Chris
    Chris avatar
    20 posts
    Member since:
    Sep 2007

    Posted 15 Nov 2009 Link to this post

    I've downloaded the latest edition of Open Access and I cannot use it on an existing website.

    When I try "enable project to use ORM", everything is fine on the first screen.  I click next and on the "Does your project contain the following?", persistent classes? is greyed out and not selectable, however DAL is selectable.  If I select DAL on the next screen everything is greyed out.  The "Select connection" dropdown is defaulted to "none".  If I select "custom defined", then the other boxes become selectable.  I click NEXT and on the finish screen, I get this error:

    "OpenAccess Error"

    "The following problem(s) have occurred:

    1.  Config file:  C:\websites\sitename\Web.config cannot be changed.  Cause:  System.InvalidCastException:   Unable to cast object of type 'System.Xml.XmlComment' to type 'System.Xml.XmlElement'. at Telerik.OpenAccess.Sdk.Addin.Xml.XmlHelper.GetXmlElementByAttrKey(XmlNode parentNode, String elementName, String attrKey, String attrValue, Boolean partialMatch, Boolean create, Boolean prepend) at Telerik.OpenAccess.Sdk.Addin.Core.ProjectEnabler.UpdateConfigFile(VAProject project, Parameters parms, String configFileName)
    To fix the problem(s), try the following:

    Re-execute the 'Enable Project" wizard on the project or execute 'Check Settings' from the OpenAccess menu"

    When I re-execute, I get the same error.  When I check settings, the only thing selectable on this project is, Validators and Update assembly references and they are selected by default.  If I click "Check", everything is fine there.  There are no errors and I still can't enable this project.

    Help!
  2. Chris
    Chris avatar
    20 posts
    Member since:
    Sep 2007

    Posted 15 Nov 2009 Link to this post

    I removed all of the comments from my web.config and this time it ended without errors.  However, it's still acting flaky.  When I try to reverse map an existing database, it's now saying it can't find my connectionstring in my web.config.  I'm looking right at the connectionstring.
  3. DevCraft banner
  4. Answer
    Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 16 Nov 2009 Link to this post

    Hi Greg,

    Currently OpenAccess does not support generation of persistent classes inside web projects. You will have to create a separate Class Library project, generate the classes there and then reference this project from the web site. The process is fully described in this help topic.
    If you run the Enable project wizard for a web project (as you did), page 3 provides the option to add a connection string to the Web.config which will override the connection string used in the class library. When a project of type Class Library is being enabled, page 3 contains some additional controls that can be used to set the connection. In the near future we will provide support for having the persistent classes inside web applications as well. However, this will not be possible for web sites as they cannot be compiled to an assembly.

    Besides that, the error you faced seems to be a bug in the wizard and is observed when the <assemblies> section of the configuration file contains comments. Thank you for reporting it, we will fix it for the next version of the product. Your Telerik points have been updated.

    Best wishes,
    Alexander
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top