tags:

views:

625

answers:

0

I have a web application where im using WMI connection through asp.net from Computer A(Windows XP) to Computer B(Windows 2003 Server..). the code is as follows...(and the below code works if the operating systems in both the systems are same otherwise it"s not working...)

ConnectionOptions options = new ConnectionOptions();

options.Username =username; options.Password = password;

string machinename = "***";

// Read registry of remote machine....

ManagementScope myScope = new ManagementScope("\\" + machinename + "\root\default", options); myScope.Options.EnablePrivileges = true;

myScope.Options.Impersonation = ImpersonationLevel.Impersonate;myScope.Options.Authentication = AuthenticationLevel.Packet; myScope.Connect();

and the error is ...

Server Error in '/' Application.

The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) 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: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

Source Error:

Line 77: myScope.Options.Authentication = AuthenticationLevel.Packet; Line 78: mySearcher = new ManagementObjectSearcher(myScope, myQuery); Line 79: myScope.Connect(); Line 80: //myQueryCollection = mySearcher.Get(); Line 81:

Source File: D:\Tools Validator\Skywebadmin\Skywebadmin\WebForm6.aspx.cs Line: 79

Stack Trace:

[COMException (0x800706ba): The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)] System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) +0 System.Management.ManagementScope.InitializeGuts(Object o) +783 System.Management.ManagementScope.Initialize() +216 System.Management.ManagementScope.Connect() +5 Skywebadmin.WebForm6.Button1_Click(Object sender, EventArgs e) in D:\Tools Validator\Skywebadmin\Skywebadmin\WebForm6.aspx.cs:79 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102


Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

RPC ,WMI were running in both systems even windows firewall is off....

Please help me out........