Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

Ad LDS There is no such object on the server.

$
0
0

I am using below code to create user in AD LDS which is installed on different server. In my local machine which is a remote desktop(VDI) it works but after deployment to server different host name it gives error "There is no such object on the server" giving response header obtained 

var host = "SV1GBVDEVDB163";
var port = 389;

var machineName = string.Format("{0}:{1}", host, port);
var container = "CN=PSExtUser,CN=PSADLDSPartition1,DC=PS,DC=COM";

var principalContext = new PrincipalContext(ContextType.ApplicationDirectory, machineName, container);
UserPrincipal usr = UserPrincipal.FindByIdentity(principalContext, userId);

UserPrincipal newUser = new UserPrincipal(principalContext);
newUser.Name = userId;
newUser.UserPrincipalName = userId;
newUser.SetPassword(pwd.ToString());
newUser.Enabled = false;
newUser.Save();

response header obtained 

<!DOCTYPE html>

<html>

    <head>

        <title>There is no such object on the server.<br></title>

        <meta name="viewport" content="width=device-width" />

        <style>

         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}

         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}

         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}

         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }

         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }

         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}

         .marker {font-weight: bold; color: black;text-decoration: none;}

         .version {color: gray;}

         .error {margin-bottom: 10px;}

         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }

         @media screen and (max-width: 639px) {

          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }

         }

         @media screen and (max-width: 479px) {

          pre { width: 280px; }

         }

        </style>

    </head>

 

    <body bgcolor="white">

 

            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

 

            <h2> <i>There is no such object on the server.<br></i> </h2></span>

 

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

 

            <b> Description: </b>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.

 

            <br><br>

 

            <b> Exception Details: </b>System.DirectoryServices.DirectoryServicesCOMException: There is no such object on the server.<br><br><br>

 

            <b>Source Error:</b> <br><br>

 

            <table width=100% bgcolor="#ffffcc">

               <tr>

                  <td>

                      <code>

 

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.</code>

 

                  </td>

               </tr>

            </table>

 

            <br>

 

            <b>Stack Trace:</b> <br><br>

 

            <table width=100% bgcolor="#ffffcc">

               <tr>

                  <td>

                      <code><pre>

 

[DirectoryServicesCOMException (0x80072030): There is no such object on the server.

]

   System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +597561

   System.DirectoryServices.DirectoryEntry.Bind() +44

   System.DirectoryServices.DirectoryEntry.get_AdsObject() +42

   System.DirectoryServices.DirectoryEntry.get_Options() +42

   System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInit() +351

 

[PrincipalOperationException: There is no such object on the server.

]

   System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInit() +495548

   System.DirectoryServices.AccountManagement.PrincipalContext.DoApplicationDirectoryInit() +61

   System.DirectoryServices.AccountManagement.PrincipalContext.Initialize() +184

   System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx() +42

   System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate) +29

   System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity(PrincipalContext context, String identityValue) +81

   

   lambda_method(Closure , ControllerBase , Object[] ) +127

   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +258

   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39

   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass42.&lt;BeginInvokeSynchronousActionMethod&gt;b__41() +34

   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass39.&lt;BeginInvokeActionMethodWithFilters&gt;b__33() +124

   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4f.&lt;InvokeActionMethodFilterAsynchronously&gt;b__49() +786611

   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4f.&lt;InvokeActionMethodFilterAsynchronously&gt;b__49() +786611

   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4f.&lt;InvokeActionMethodFilterAsynchronously&gt;b__49() +786611

   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass37.&lt;BeginInvokeActionMethodWithFilters&gt;b__36(IAsyncResult asyncResult) +15

   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass2a.&lt;BeginInvokeAction&gt;b__20() +33

   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass25.&lt;BeginInvokeAction&gt;b__22(IAsyncResult asyncResult) +787092

   System.Web.Mvc.&lt;&gt;c__DisplayClass1d.&lt;BeginExecuteCore&gt;b__18(IAsyncResult asyncResult) +28

   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.&lt;MakeVoidDelegate&gt;b__3(IAsyncResult ar) +15

   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +65

   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.&lt;MakeVoidDelegate&gt;b__3(IAsyncResult ar) +15

   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +51

   System.Web.Mvc.&lt;&gt;c__DisplayClass8.&lt;BeginProcessRequest&gt;b__3(IAsyncResult asyncResult) +42

   System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.&lt;MakeVoidDelegate&gt;b__3(IAsyncResult ar) +15

   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +51

   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606

   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +288

</pre></code>

 

                  </td>

               </tr>

            </table>

 

            <br>

 

            <hr width=100% size=1 color=silver>

 

            <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212

 

            </font>

 

    </body>

</html>

<!--

[DirectoryServicesCOMException]: There is no such object on the server.

 

   at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)

   at System.DirectoryServices.DirectoryEntry.Bind()

   at System.DirectoryServices.DirectoryEntry.get_AdsObject()

   at System.DirectoryServices.DirectoryEntry.get_Options()

   at System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInit()

[PrincipalOperationException]: There is no such object on the server.

 

   at System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInit()

   at System.DirectoryServices.AccountManagement.PrincipalContext.DoApplicationDirectoryInit()

   at System.DirectoryServices.AccountManagement.PrincipalContext.Initialize()

   at System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx()

   at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate)

   at System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity(PrincipalContext context, String identityValue)

   

   at lambda_method(Closure , ControllerBase , Object[] )

   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)

   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)

   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41()

   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33()

   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49()

   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49()

   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49()

   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult)

   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<>c__DisplayClass2a.<BeginInvokeAction>b__20()

   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult)

   at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult)

   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)

   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)

   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)

   at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)

   at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult)

   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)

   at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)

   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

-->

 


Viewing all articles
Browse latest Browse all 4737

Trending Articles