COMException error

Oct 24, 2011 at 10:21 PM

Thanks to all who have helped me get past my errors with Role Provider and DB Connection string today. I think we're closing in on operability but I have one more hurdle to clear. Once again, the configuration is a web server with IIS7 on Windows Server 2008 R2 connecting to AD 2003 and a DB server running SQL Server 2008 R2 on Windows Server 2008 R2. We have a new error!

 

Server Error in '/' Application.

An operations error occurred.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: An operations error occurred.


Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[COMException (0x80072020): An operations error occurred.
]
   System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +420085
   System.DirectoryServices.DirectoryEntry.Bind() +36
   System.DirectoryServices.DirectoryEntry.get_AdsObject() +31
   System.DirectoryServices.PropertyValueCollection.PopulateList() +26
   System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName) +49
   System.DirectoryServices.PropertyCollection.get_Item(String propertyName) +141
   System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer() +1134
   System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit() +37
   System.DirectoryServices.AccountManagement.PrincipalContext.Initialize() +124
   System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx() +31
   System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate) +14
   System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, String identityValue) +73
   System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity(PrincipalContext context, String identityValue) +25
   PPI.UMS.AD.User..ctor(String Username) +232
   PPI.UMS.Web.App_Master.Admin.Page_Load(Object sender, EventArgs e) +72
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +91
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Control.LoadRecursive() +146
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

IIS is set with Anonymous disabled and Windows Auth enabled. I get this error after being challenged for username and password and supplying AD domain creds (the umanage user).
Is there anything I can do to supply better data? Thanks for the help!
Coordinator
Oct 25, 2011 at 2:19 AM

Greg,

Can you send me your complete web.config file? You are free to remove the passwords if you like. But I would need to review the config file to help you with this one.

E-mail me: bpabst@pabstproductions.com

Thanks,

Brent

Oct 25, 2011 at 6:51 AM

Got the same error here.

Lots of trouble setting this thingy up.

Web.config does not get edited.

Addroles.sql needed modification

now this error.

Oct 25, 2011 at 5:05 PM

Brent,

I'll sterilize and post the web.config here just as soon as I can today. Thank you very much for your assistance!

Oct 25, 2011 at 5:08 PM

That didn't take long at all!

 

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=152368
  -->
<configuration>
 
  <connectionStrings>
    <clear/>
    <add name="ADService" connectionString="LDAP://wdccfe.hmco.com" />
    <add name="uManageEntities" providerName="System.Data.EntityClient" connectionString="metadata=res://*/uManage.csdl|res://*/uManage.ssdl|res://*/uManage.msl;provider=System.Data.SqlClient;provider connection string='Data Source=155.44.231.79;Initial Catalog=uManage-WDCCFE.HMCO.COM;User ID=umanage;Password=Variable;MultipleActiveResultSets=True;'"/>
  </connectionStrings>
 
  <appSettings>
    <add key="LaunchSetupWizard" value="false" />
    <add key="AllowUserPasswordChanges" value="True" />
    <add key="AllowUserAttibChanges" value="True" />
    <add key="AllowUserNameChanges" value="True" />
    <add key="AllowUserEmailChanges" value="True" />
    <add key="AllowUserLocationChanges" value="True" />
    <add key="AllowUserPhoneChanges" value="True" />
    <add key="AllowUserPhotoChanges" value="True" />
    <add key="DisplayUserAccountNotes" value="True" />
    <add key="DisplayUserLocationSection" value="True" />
    <add key="DisplayUserPhoneSection" value="True" />
    <add key="DisplayUserOrganizationSection" value="True" />
    <add key="DisplayUserPhotoSection" value="True" />
    <add key="EnableMsftTag" value="False" />
    <add key="MsftTagApiKey" value="" />
    <add key="EnableOfficeLocationList" value="False" />
    <add key="AdGroupName" value="uManage-Users" />
    <add key="EnableNewUserCreation" value="True" />
    <add key="NewUsernameFormat" value="$fi$$lname$" />
    <add key="NewUserContainer" value="" />
    <add key="CompanyName" value="" />
    <add key="CompanyAddress" value="" />
    <add key="CompanyCity" value="" />
    <add key="CompanyState" value="" />
    <add key="CompanyPostal" value="" />
    <add key="CompanyCountry" value="" />
    <add key="CompanyPhone" value="" />
  </appSettings>
 
  <system.web>
   
    <globalization culture="auto" uiCulture="auto"/>
   
    <compilation targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>
   
    <machineKey validationKey="09D8FFEF333751A30477F57EF1C42CBC927F90BCB7BA97DE17D8A70EE5C37963CB73F255FA6347A76333FE124D55891367657D5E697D058D778B69161E0006E9" decryptionKey="D7DEA71B10DF39A927AB21EC2255E853150703558D1526F158183EB106BD4161" validation="SHA1" decryption="AES"/>
   
    <customErrors defaultRedirect="~/Forms/Error.aspx" mode="Off" />
   
    <pages theme="Default">
      <controls>
        <add tagPrefix="ums" tagName="Dialog" src="~/Controls/Dialog.ascx" />
        <add tagPrefix="ums" tagName="SlidingPanel" src="~/Controls/SlidingPanel.ascx" />
        <add tagPrefix="ums" tagName="UserContactCard" src="~/Controls/UserContactCard.ascx" />
        <add tagPrefix="ajax" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit, Version=3.0.30930.28736, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" />
      </controls>
    </pages>
   
    <siteMap defaultProvider="UserSitemapProvider">
      <providers>
        <add name="UserSitemapProvider" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Sitemaps/User.sitemap"/>
        <add name="AdminSitemapProvider" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Sitemaps/Admin.sitemap" securityTrimmingEnabled="true"/>
      </providers>
    </siteMap>
   
    <authentication mode="Windows"/>
    <!-- Because the membership section gets encrypted we leave this copy for devs and troubleshooting
          <membership defaultProvider="AspNetActiveDirectoryMembershipProvider">
            <providers>
              <clear/>
              <add connectionStringName="ADService" connectionUsername=""
                connectionPassword="" enablePasswordReset="true" enableSearchMethods="true"
                applicationName="uManage" clientSearchTimeout="30" serverSearchTimeout="30"
                name="AspNetActiveDirectoryMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.3600, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
            </providers>
          </membership>
    -->
   
    <membership defaultProvider="AspNetActiveDirectoryMembershipProvider">
      <providers>
        <clear/>
        <add connectionStringName="ADService" connectionUsername="" connectionPassword=""
          enablePasswordReset="true" enableSearchMethods="true" applicationName="uManage"
          clientSearchTimeout="30" serverSearchTimeout="30" name="AspNetActiveDirectoryMembershipProvider"
          type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.3600, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </providers>
    </membership>
   
    <roleManager enabled="true" defaultProvider="RoleProvider"  cacheRolesInCookie="true" cookieName=".uManageRoles"
      cookieTimeout="15" cookiePath="/" cookieSlidingExpiration="true"
      cookieProtection="All">
      <providers>
        <clear/>
        <add connectionStringName="uManageEntities" applicationName="uManage"
          name="RoleProvider" type="PPI.UMS.BLL.UmsRoleProvider" />
      </providers>
    </roleManager>
   
   
  </system.web>
 
  <system.webServer>
   
    <modules runAllManagedModulesForAllRequests="true" />
   
  </system.webServer>
 
  <system.net>
   
    <mailSettings>
      <!-- Because the smtp section gets encrypted we leave this copy for devs and troubleshooting
            <smtp from="">
              <network host="" port="" defaultCredentials="" enableSsl="" userName="" password=""/>
            </smtp>   
      -->
      <smtp from="">
        <network defaultCredentials="false" host="" password="" port="25"
          userName="" enableSsl="false" />
      </smtp>
    </mailSettings>
   
  </system.net>
 
</configuration>

Coordinator
Oct 25, 2011 at 5:33 PM

Greg,

This is my guess, take a look at the Membership Provider section. It’s missing the credentials for the user or service account you intend to access the directory with. Essentially the username or password that will execute all requests against the directory. The username and password are both blank. Try using a set of admin credentials to see if that fixes things. There are instructions on the Codeplex site on how to delegate the proper permissions to a service account which is what I recommend you use.

Here is the section to look at:

<membership defaultProvider="AspNetActiveDirectoryMembershipProvider">
<providers>
<clear/>
<add connectionStringName="ADService" connectionUsername="" connectionPassword=""
enablePasswordReset="true" enableSearchMethods="true" applicationName="uManage"

Hope that helps/fixes it. Sorry for all of the problems with the wizard! We’re going to try and release a new version of uManage soon which fixes a lot of problems.

Thanks,

Brent

Oct 25, 2011 at 6:04 PM

Hey!! No problem! I don't mind taking a walk on the wild site to help test things out.

Your suggestion was valid enough to change my error to one of "The format of the specified domain name is invalid."

You can see what my config is. Is there a section where I need to provide a little more data in the config?

Coordinator
Oct 25, 2011 at 6:06 PM

Hmm,

Interesting. Try changing the LDAP:// to simply ldap:// I don’t think that’s the problem but you never know.

Good luck!

Brent

Oct 25, 2011 at 6:20 PM

Unfortunately, that didn't get much mileage. Here's the output (please let me know if you want me to create a new thread):

The format of the specified domain name is invalid.

Description:

An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.DirectoryServices.ActiveDirectory.ActiveDirectoryOperationException: The format of the specified domain name is invalid.


Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[ActiveDirectoryOperationException: The format of the specified domain name is invalid.
]
   System.DirectoryServices.ActiveDirectory.DirectoryContext.GetDnsDomainName(String domainName) +386189
   System.DirectoryServices.ActiveDirectory.DirectoryContext.GetLoggedOnDomain() +629
   System.DirectoryServices.ActiveDirectory.DirectoryContext.IsContextValid(DirectoryContext context, DirectoryContextType contextType) +120
   System.DirectoryServices.ActiveDirectory.DirectoryContext.isDomain() +51
   System.DirectoryServices.ActiveDirectory.Domain.GetDomain(DirectoryContext context) +89
   PPI.UMS.AD.PasswordExpires..ctor() +59
   PPI.UMS.AD.User.BuildUserFromPrincipal(UserPrincipal user) +544
   PPI.UMS.AD.User..ctor(String Username) +257
   PPI.UMS.Web.App_Master.Admin.Page_Load(Object sender, EventArgs e) +72
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +91
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Control.LoadRecursive() +146
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207