こんにちは、asp.net アプリケーションに問題があります。
問題は、アプリケーションをローカルホストで問題なく実行できることですが、サーバー上の IIS7 にインストールするとエラーが発生します。エラーを見つけようとして、ある領域でエラーを選択しました。
エラーメッセージは次のとおりです。
Object reference not set to an instance of an object.
bei linde_wiemann_gastzugang.linde_wiemann_daten.IsGroupMember(String dc, String user, String group) in D:\Programmierung\Visual_Studio_2010\Projekte\lw_gastzugang\lw_gastzugang\lw_daten.cs:Zeile 30.
コードは次のとおりです。
public static bool IsGroupMember(string dc, string user, string group)
{
try
{
using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain, dc))
{
bool found = false;
GroupPrincipal p = GroupPrincipal.FindByIdentity(ctx, group);
UserPrincipal u = UserPrincipal.FindByIdentity(ctx, IdentityType.SamAccountName, user);
found = p.GetMembers(true).Contains(u); //I think the error is here :(
p.Dispose();
u.Dispose();
return found; // <-- Zeile 30
}
}
catch (Exception ex)
{
EventLogManager.CreateEventLog("Gastzugang",ex.Message + " : " + dc + " - " + user + " - " + group);
return false;
}
ハードコード値をどのように真に使用しようとしていますが、それはそれらで機能します:/ このコードを使用できない IIS の原因は何ですか?