Server 2008 R2を実行しているWebサーバーのワークグループがあり、すべてのサーバーのディスク容量をチェックするスクリプトを管理しようとしています。数か月前にサーバーがセットアップされていたときにこれをセットアップしましたが、正常に機能していたと思います。確認してみると、「RPCサーバーが利用できません」というエラーが表示されます。スクリプトはC#ASP.NETページですが、PowerShellで同等の呼び出しを試しましたが、同じエラーが発生します。スクリプトはローカルマシンの情報にアクセスするために正常に機能しますが、リモートサーバーの情報にアクセスすることはできません。
私はここ数時間、見つけたものすべてを掘り下げてきましたが、何も機能しません。WMI(リモートとローカル)、DCOM(リモートとローカル)、およびアクセスしているコンピューターのドライブ全体のアクセス許可を設定しました。コンピューター名、IPアドレス、完全なコンピューター名(xxx.echomountain.com)を使用し、ConnectionOptionsオブジェクトで多数の偽装と認証の設定を試しました。
使用しているユーザー名/パスワードが正しいことはわかっています。一方のシャードディレクトリにもう一方からアクセスできるからです。
このエラーを引き起こす可能性のある他に何を確認できるかについてのアイデアはありますか?
ConnectionOptions oConn = new ConnectionOptions();
oConn.Impersonation = ImpersonationLevel.Impersonate;
oConn.EnablePrivileges = true;
oConn.Username = username;
oConn.Password = password;
//oConn.Authentication = AuthenticationLevel.PacketPrivacy;
string strNameSpace = @"\\";
if (srvname != "")
strNameSpace += srvname + ".echomountain.com";
else
strNameSpace += ".";
strNameSpace += @"\root\cimv2";
ManagementScope oMs = new ManagementScope(strNameSpace, oConn);
//get Fixed disk state
ObjectQuery oQuery = new ObjectQuery("select FreeSpace,Size,Name from Win32_LogicalDisk where DriveType=3");
//Execute the query
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oMs, oQuery);
//Get the results
ManagementObjectCollection oReturnCollection = oSearcher.Get();
//loop through found drives and write out info
double D_Freespace = 0;
double D_Totalspace = 0;
foreach (ManagementObject oReturn in oReturnCollection)
{
// Disk name
//MessageBox.Show("Name : " + oReturn["Name"].ToString());
// Free Space in bytes
string strFreespace = oReturn["FreeSpace"].ToString();
D_Freespace = D_Freespace + System.Convert.ToDouble(strFreespace);
// Size in bytes
string strTotalspace = oReturn["Size"].ToString();
D_Totalspace = D_Totalspace + System.Convert.ToDouble(strTotalspace);
boxSize = (D_Totalspace / GB).ToString("##.00");
boxFree = (D_Freespace / GB).ToString("##.00");
Response.Write(srvname + ":" + boxSize + ":" + boxFree);
}
'/'アプリケーションのサーバーエラー。
RPCサーバーは利用できません。(HRESULTからの例外:0x800706BA)
説明:現在のWebリクエストの実行中に未処理の例外が発生しました。エラーとエラーがコードのどこで発生したかについての詳細は、スタックトレースを確認してください。
例外の詳細:System.Runtime.InteropServices.COM例外:RPCサーバーを使用できません。(HRESULTからの例外:0x800706BA)
ソースエラー:
64行目:65行目://結果を取得します66行目:ManagementObjectCollection oReturnCollection = oSearcher.Get(); 67行目:68行目://見つかったドライブをループして情報を書き出す
ソースファイル:c:\ Web \ medelaimages.com \ iis \ tool \ boxinfoagent.aspx行:66
スタックトレース:
[COMException(0x800706ba):RPCサーバーは利用できません。(HRESULTからの例外:0x800706BA)] System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode、IntPtr errorInfo)+0 System.Management.ManagementScope.InitializeGuts(Object o)+674 System.Management.ManagementScope.Initialize()+347 System.Management.ManagementObjectSearcher.Initialize()+189 System.Management.ManagementObjectSearcher.Get()+54 ASP.tool_boxinfoagent_aspx.Page_Load(Object sender、EventArgs e)in c:\ Web \ medelaimages.com \ iis \ tool\boxinfoagent。 aspx:66 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp、Object o、Object t、EventArgs e)+25 System.Web.UI.Control.LoadRecursive()+71 System.Web.UI.Page.ProcessRequestMain(ブール値includeStagesBeforeAsyncPoint、ブール値includeStagesAfterAsyncPoint)+3048
バージョン情報:Microsoft .NET Frameworkバージョン:4.0.30319; ASP.NETバージョン:4.0.30319.1