locked
Microsoft.LightSwitch.SecurityData.svc/GetAuthenticationType 404 Not found in iis server RRS feed

  • Question

  • Microsoft.LightSwitch.SecurityData.svc/GetAuthenticationType 404 Not found error occur w hile host the lightswitch html client application in IIS server

    Please any one help me....


    gobalakrishnan S

    Saturday, October 18, 2014 7:57 AM

Answers

  • Have you attached a credential to your security service call?  You need to include System.Net and add Microsoft.OData.Client from NuGet.   Then you can do the following:

    // Format the service URI in a standardized manner
    var svcUri = New Uri("http://<app-root-uri>/Microsoft.LightSwitch.SecurityData.svc");
    // Assign a reference to the service to the svcContext variable
    var svcContext = new DataServiceClient(svcUri);
    // Assign the credential to the service
    svcContext.Credential = new Credential("<username>", "<password>");
    
    // Now you should be able to create linq queries against svcContext DataService
    
    // e.g. to create a new user
    var userReg = new UserRegistration("NewUserName", "New User Full Name");
    userReg.Password = "E$*(8f9ds0s9811$$#dnhfsdjkfsd";
    svcContext.AddToUserRegistrations(userReg);
    
    //To update a different user's password
    var userReg = (from _userReg in svcContext.UserRegistrations
                   where _userReg.UserName == "ExistingUser"
                   select _userReg).First();
    userReg.Password = "fd8**08fDFSDFudsf712414&&";
    svcContext.UpdateObject(userReg);

    You can also add roles using this service, as well as RoleAssignment objects and RolePermissions.  The key to getting past the 404 error is the Credential assignment though.

    Hope that helps :)

    • Marked as answer by Angie Xu Tuesday, October 28, 2014 6:49 AM
    Saturday, October 18, 2014 3:49 PM