Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
Getting a 401 error of SecurityDataServiceDomainService when adding a (windows) user to my application

Locked Getting a 401 error of SecurityDataServiceDomainService when adding a (windows) user to my application

  • Friday, February 04, 2011 12:57 PM
     
     

    Hi,

    we are currently testing single sign-on for lightswitch for an application that will run on the intranet. I have setup the windows authentication according to Beth Massi's blog. i can do everything, except 1 thing: i can't add a new user... The applcation says the password is not in the right format for the default provider.. i know not every error message is always what it seems, so i dug in with fiddler and found the following return

    Request:
    ---/Web/Microsoft-LightSwitch-Security-ServerGenerated-Implementation-SecurityDataServiceDomainService.svc/binary/SubmitChanges

    Response:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
    <HTML>
       <HEAD>
          <TITLE>Not Authorized</TITLE>
             <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii">
        </HEAD>
        <BODY>
        <h2>Not Authorized</h2>
        <hr><p>HTTP Error 401. The requested resource requires user authentication.</p>
    </BODY>
    </HTML>

    I tried to output the same application using Forms and that worked fine.. to make things more confusing: i can add and save roles on the existing admin user, but when i create a new one.. i get this error. did anyone else got this issue??

    When i deploy new user information without dropping the table, the user is added and everything works fine.. it is just when i use the /createadmin command from the tools or when i do it using the UI.

All Replies

  • Friday, February 04, 2011 1:23 PM
     
     

    because it might do someone any good in seeing the stacktrace (when you set the CustomErrors mode to Off)

     

    @Fault5http://schemas.microsoft.com/ws/2005/05/envelope/none@Code@Value�Sender@Reason@Textxmllang�en-US��<?xml version="1.0" encoding="utf-16"?><ExceptionInfo><Message>The password supplied is invalid. Passwords must conform to the password strength requirements configured for the default provider.</Message><StackTrace> at Microsoft.LightSwitch.Security.ServerGenerated.Implementation.SecurityDataProvider.InsertEntity(EntityObject entity)

    at Microsoft.LightSwitch.Security.ServerGenerated.Implementation.SecurityDataProvider.SubmitCore(IEnumerable`1 changes)

    at Microsoft.LightSwitch.ServerGenerated.Implementation.DataProvider.DataProvider.Submit(IEnumerable`1 changes)

    at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.PerformPersist(IEnumerable`1 eventsChangeSetItems)

    at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.Microsoft.LightSwitch.ServerGenerated.Implementation.IServerDataServiceImplementationCore.Submit()

    at Microsoft.LightSwitch.ServerGenerated.Implementation.DomainService`1.InvokeSubmit()

    at Microsoft.LightSwitch.ServerGenerated.Implementation.DomainService`1.&lt;PersistChangeSet&gt;b__13()

    at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.Microsoft.LightSwitch.ServerGenerated.Implementation.IServerDataServiceImplementationCore.InvokeOperation[T](String operationName, Object[] args, Boolean invokedFromClient, Func`1 invokeOperation, Action`1 catchCallback)</StackTrace><ErrorInfo /></ExceptionInfo>@Detail@DomainServiceFaultDomainServices i)http://www.w3.org/2001/XMLSchema-instance@ ErrorCode�@

    ErrorMessage��<?xml version="1.0" encoding="utf-16"?><ExceptionInfo><Message>The password supplied is invalid. Passwords must conform to the password strength requirements configured for the default provider.</Message><StackTrace> at Microsoft.LightSwitch.Security.ServerGenerated.Implementation.SecurityDataProvider.InsertEntity(EntityObject entity)

    at Microsoft.LightSwitch.Security.ServerGenerated.Implementation.SecurityDataProvider.SubmitCore(IEnumerable`1 changes)

    at Microsoft.LightSwitch.ServerGenerated.Implementation.DataProvider.DataProvider.Submit(IEnumerable`1 changes)

    at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.PerformPersist(IEnumerable`1 eventsChangeSetItems)

    at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.Microsoft.LightSwitch.ServerGenerated.Implementation.IServerDataServiceImplementationCore.Submit()

    at Microsoft.LightSwitch.ServerGenerated.Implementation.DomainService`1.InvokeSubmit()

    at Microsoft.LightSwitch.ServerGenerated.Implementation.DomainService`1.&lt;PersistChangeSet&gt;b__13()

    at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.Microsoft.LightSwitch.ServerGenerated.Implementation.IServerDataServiceImplementationCore.InvokeOperation[T](String operationName, Object[] args, Boolean invokedFromClient, Func`1 invokeOperation, Action`1 catchCallback)</StackTrace><ErrorInfo /></ExceptionInfo>@IsDomainException�@

    StackTrace�� at Microsoft.LightSwitch.Threading.DispatcherExtensions.InvokeWithWait(IDispatcher dispatcher, Action`1 action)

    at Microsoft.LightSwitch.Threading.DispatcherExtensions.Invoke(IDispatcher dispatcher, Action action)

    at Microsoft.LightSwitch.ServerGenerated.Implementation.DomainService`1.Submit(ChangeSet changeSet)

    at System.ServiceModel.DomainServices.Hosting.SubmitOperationBehavior.SubmitOperationInvoker.InvokeCore(Object instance, Object[] inputs, Object[]& outputs)

  • Friday, February 04, 2011 2:33 PM
     
     Answered

    How is your system.web/membership element in the web.config file configured?  Could you paste that in a reply?  I'm thinking that might be the issue here.  It should look something like this:

        <membership defaultProvider="AspNetMembershipProvider">
          <providers>
            <clear />
            <add name="AspNetMembershipProvider" type="Microsoft.LightSwitch.Security.ServerGenerated.Implementation.WindowsUserMembershipProvider, Microsoft.LightSwitch.Base.Server, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="_IntrinsicData" applicationName="YOUR_APPLICATION_NAME" />
          </providers>
        </membership>

    • Marked As Answer by Didier Caron Friday, February 04, 2011 3:05 PM
    •  
  • Friday, February 04, 2011 3:00 PM
     
     

    Hi Matt,

     

    if i compare mine :

    <add name="AspNetMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="_IntrinsicData"
      applicationName="xxx"
      requiresUniqueEmail="false" requiresQuestionAndAnswer="false" minRequiredPasswordLength="1" passwordStrengthRegularExpression="" minRequiredNonalphanumericCharacters="0" />

    with yours, mine is off by a couple of lightyears.. i'll try your suggestion. (and mark your answer if it turned out to be right)

  • Friday, February 04, 2011 3:08 PM
     
     

    Really appreciate the help! i didn't see it in beth's blogpost

    http://blogs.msdn.com/b/bethmassi/archive/2010/10/06/implementing-security-in-a-lightswitch-application.aspx

    i'll create a link to this thread over there as well for anyone who runs into the same problem.