简体   繁体   English

如果用户名相同(管理员),则DCOM身份“交互式用户”和“此用户”有什么区别?

[英]What is different between DCOM Identity “The interactive user” and “This user” if the username is the same (Administrator)?

I'm working on an ASP webpage that uses a Minitab DCOM object. 我正在使用Minitab DCOM对象的ASP网页上工作。 My problem is that this DCOM object stops responding (hangs) if the Identity is set as “This User” under Component Services (DCONCNFG) but if I log into windows with the user that I used under “This User” and set the Identity as “Interactive user” everything works fine. 我的问题是,如果在组件服务(DCONCNFG)下将标识设置为“此用户”,但是如果我使用在“此用户”下使用的用户登录Windows并将标识设置为,则此DCOM对象将停止响应(挂起) “互动用户”一切正常。

My question is what is different between DCOM Identity “The interactive user” and “This user” if the username is the same (Administrator)? 我的问题是,如果用户名相同(管理员),则DCOM身份“交互式用户”和“此用户”之间有什么区别?

Mainly this webpage uses Minitab to generate graphs. 该网页主要使用Minitab生成图形。 Before it hangs it does generate graphs but only 5 or 6 graphs then it stops responding. 在挂起之前,它确实会生成图形,但是只有5或6个图形会停止响应。

Here is the C# code incase you are wondering where it hangs: 这是C#代码,以防您将其挂在哪里:

using System;
using System.Web;
using System.Web.UI.WebControls;
using Mtb;        // Minitab Library (Mtb 16.0 Type Library)
using System.IO;
using System.Data;
using System.Runtime.InteropServices;
using System.Threading;




namespace TRWebApp.TestDetails
{
    public partial class TestDetails : System.Web.UI.Page
    {

        // MiniTab Stuff
        Mtb.IApplication g_MtbApp;
        Mtb.IProject g_MtbProj;
        Mtb.IUserInterface g_MtbUI;
        Mtb.IWorksheets g_MtbWkShts;
        Mtb.ICommands g_MtbCommands;

        Mtb.IOutputs g_MtbOutputs;
        Mtb.IGraph g_MtbGraph;

        Mtb.IOutputs g_MtbOutputs2;
        Mtb.IGraph g_MtbGraph2;

        int g_GraphIdx = 1;

        int g_Loop = 1;

        // Tests Table
        enum testsTable { TestIdx, TestSeq, ParamName, LSL, USL, Units };

        Tools tools = new Tools();

        string g_SessionID = "";

        Mtb_DataSetTableAdapters.XBarTableAdapter xbarTA = new Mtb_DataSetTableAdapters.XBarTableAdapter();

        protected void Page_Init(object sender, EventArgs e) 
        {
            g_MtbApp = new Application();
            g_MtbProj = g_MtbApp.ActiveProject;
            g_MtbUI = g_MtbApp.UserInterface;
            g_MtbWkShts = g_MtbProj.Worksheets;
            g_MtbCommands = g_MtbProj.Commands;

            g_MtbUI.DisplayAlerts = false;
            g_MtbUI.Interactive = false;
            g_MtbUI.UserControl = false; 


            lblProductDesc.Text = "";       // Start with a clear variable

            g_SessionID = HttpContext.Current.Session.SessionID;


            string imgFolder = "Images/Mtb/";

            string mtbSessionPath = Server.MapPath(ResolveUrl("~/" + imgFolder)) + g_SessionID;

            Directory.CreateDirectory(mtbSessionPath);
            Array.ForEach(Directory.GetFiles(mtbSessionPath), File.Delete); // Delete all the files from the directory

            Session["MtbSessionPath"] = mtbSessionPath;   // Store the Session Path so we can later delete it


            // Add the two image columns to the grid view
            GridView1.AutoGenerateColumns = false;

            ImageField imgColumn = new ImageField();
            imgColumn.HeaderText = "Scatterplot";
            imgColumn.DataImageUrlField = "TestIdx";
            imgColumn.DataImageUrlFormatString = "~\\Images\\Mtb\\" + g_SessionID + "\\{0}.GIF";
            imgColumn.ControlStyle.CssClass = "MtbImgDetail";
            GridView1.Columns.Add(imgColumn);

            ImageField img2Column = new ImageField();
            img2Column.HeaderText = "Histogram";
            img2Column.DataImageUrlField = "TestIdx";
            img2Column.DataImageUrlFormatString = "~\\Images\\Mtb\\" + g_SessionID + "\\H{0}.GIF";
            img2Column.ControlStyle.CssClass = "MtbImgDetail";
            GridView1.Columns.Add(img2Column);


        }

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                lblErrMsg.Text = "";

                // Fill dates if they are empty
                if (String.IsNullOrEmpty(tbxFromDate.Text))
                    tbxFromDate.Text = String.Format("{0:MM/01/yy}", DateTime.Today, null, DateTime.Today);
                if (String.IsNullOrEmpty(tbxToDate.Text))
                    tbxToDate.Text = String.Format("{0:MM/dd/yy}", DateTime.Today);

            }
            catch (Exception ex)
            {
                lblErrMsg.Text = ex.Message;
            }           

        }

        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowIndex >= 0)
            {
                // Get the data for the parameter name
                DataTable dt = xbarTA.GetXBarData(lbxProduct.SelectedValue, Convert.ToDateTime(tbxFromDate.Text), Convert.ToDateTime(tbxToDate.Text), e.Row.Cells[(int)testsTable.ParamName].Text);

                // Pass the data to an object array so we can pass it to minitab
                object[] data = new object[dt.Rows.Count];
                object[] time = new object[dt.Rows.Count];

                int i = 0;
                foreach (DataRow dr in dt.Rows)
                {
                    if (tools.IsNumeric(dr["ParamValue"]))
                    {
                        data[i] = Convert.ToDouble(dr["ParamValue"]);
                        time[i] = i;
                    }
                    i++;
                }

                if (dt.Rows.Count > 1)  // Do graphs with at least two measurements
                {
                    // Only pass it to minitab if we have numeric data
                    if (!ReferenceEquals(data[0], null))        // if it is not null it means it has a numeric value
                    {
                        g_MtbWkShts.Item(1).Columns.Add().SetData(data);
                        g_MtbWkShts.Item(1).Columns.Add().SetData(time);

                        g_MtbWkShts.Item(1).Columns.Item(1).Name = e.Row.Cells[(int)testsTable.ParamName].Text + " (" + e.Row.Cells[(int)testsTable.Units].Text + ")";
                        g_MtbWkShts.Item(1).Columns.Item(2).Name = "Time";


                        ////  H  E  R  E
                        ////
                        //// FOLLOWING LINE HANGS AFTER GENERATING 6 GRAPHS WHEN THE IDENTITY "THIS USER" IS SET
                        ////
                        g_MtbProj.ExecuteCommand("Plot C1*C2;\nSymbol;\nConnect.", g_MtbWkShts.Item(1));

                        // Convert LSL and USL to Decimal
                        if (tools.IsNumeric(e.Row.Cells[(int)testsTable.LSL].Text.Trim()) && tools.IsNumeric(e.Row.Cells[(int)testsTable.USL].Text.Trim()))
                        {
                            if (Convert.ToDouble(e.Row.Cells[(int)testsTable.LSL].Text) < Convert.ToDouble(e.Row.Cells[(int)testsTable.USL].Text))
                            {
                                g_MtbProj.ExecuteCommand("Capa C1 " + dt.Rows.Count.ToString() + ";\nLspec " + e.Row.Cells[(int)testsTable.LSL].Text + ";\nUspec " + e.Row.Cells[(int)testsTable.USL].Text + ";\nPooled;\nAMR;\nUnBiased;\nOBiased;\nToler 6;\nWithin;\nOverall;\nCStat.", g_MtbWkShts.Item(1));
                            }
                            else
                            {
                                g_MtbProj.ExecuteCommand("Histogram C1;\nBar;\nDistribution;\nNormal.", g_MtbWkShts.Item(1));
                            }
                        }
                        else
                        {
                            g_MtbProj.ExecuteCommand("Histogram C1;\nBar;\nDistribution;\nNormal.", g_MtbWkShts.Item(1));
                        }

                        try
                        {
                            g_MtbOutputs = g_MtbCommands.Item(g_GraphIdx).Outputs;
                            g_GraphIdx++;
                            g_MtbOutputs2 = g_MtbCommands.Item(g_GraphIdx).Outputs;
                            g_GraphIdx++;

                            string graphPath = "";
                            if (g_MtbOutputs.Count > 0)
                            {
                                g_MtbGraph = g_MtbOutputs.Item(1).Graph;

                                graphPath = Server.MapPath(ResolveUrl("~/Images/Mtb/")) + g_SessionID + Path.DirectorySeparatorChar + e.Row.Cells[(int)testsTable.TestIdx].Text + ".gif";
                                g_MtbGraph.SaveAs(graphPath, true, MtbGraphFileTypes.GFGIF, 600, 400, 96);
                            }

                            if (g_MtbOutputs2.Count > 0)
                            {
                                g_MtbGraph2 = g_MtbOutputs2.Item(1).Graph;

                                graphPath = Server.MapPath(ResolveUrl("~/Images/Mtb/")) + g_SessionID + Path.DirectorySeparatorChar + "H" + e.Row.Cells[(int)testsTable.TestIdx].Text + ".gif";
                                g_MtbGraph2.SaveAs(graphPath, true, MtbGraphFileTypes.GFGIF, 600, 400, 96);
                            }                                
                        }
                        catch (Exception ex)
                        {
                            lblErrMsg.Text = "Test Idx: " + e.Row.Cells[(int)testsTable.TestIdx].Text + " seems to have problems.<BR />Error: " + ex.Message;
                        }

                        g_MtbWkShts.Item(1).Columns.Delete();  // Delete all the columns (This line of code is needed otherwise the Mtb.exe will still running on the server side task manager


                    }
                    else
                    {
                        // Copy the No numeric image as a graph
                        File.Copy(Server.MapPath("~\\Images\\Mtb\\NaN.gif"), Server.MapPath("~\\Images\\Mtb\\" + g_SessionID + "\\" + e.Row.Cells[(int)testsTable.TestIdx].Text + ".gif"));
                        File.Copy(Server.MapPath("~\\Images\\Mtb\\NaN.gif"), Server.MapPath("~\\Images\\Mtb\\" + g_SessionID + "\\H" + e.Row.Cells[(int)testsTable.TestIdx].Text + ".gif"));
                    }
                }
            }
        }

        protected void GridView1_Unload(object sender, EventArgs e)
        {
            // All these lines of code are needed otherwise the Mtb.exe will not be close on the task manager (server side)
            GC.Collect();
            GC.WaitForPendingFinalizers();

            if (g_MtbGraph != null)
                Marshal.ReleaseComObject(g_MtbGraph); g_MtbGraph = null;
            if (g_MtbOutputs != null)
                Marshal.ReleaseComObject(g_MtbOutputs); g_MtbOutputs = null;

            if (g_MtbGraph2 != null)
                Marshal.ReleaseComObject(g_MtbGraph2); g_MtbGraph2 = null;
            if (g_MtbOutputs2 != null)
                Marshal.ReleaseComObject(g_MtbOutputs2); g_MtbOutputs2 = null;

            if (g_MtbCommands != null)
                Marshal.ReleaseComObject(g_MtbCommands); g_MtbCommands = null;
            if (g_MtbWkShts != null)
                Marshal.ReleaseComObject(g_MtbWkShts); g_MtbWkShts = null;
            if (g_MtbUI != null)
                Marshal.ReleaseComObject(g_MtbUI); g_MtbUI = null;
            if (g_MtbProj != null)
                Marshal.ReleaseComObject(g_MtbProj); g_MtbProj = null;

            if (g_MtbApp != null)
            {
                g_MtbApp.Quit();
                Marshal.ReleaseComObject(g_MtbApp); g_MtbApp = null;
            }            
        }        
    }
}

I'm using: 我正在使用:

Windows Server 2008 R2 Standard (SP 1) Windows Server 2008 R2标准版(SP 1)

IIS 7.5.7600.16385 IIS 7.5.7600.16385

Framework 4.0.30319 框架4.0.30319

Visual Studio 2010 Version 10.0.30319.1 Visual Studio 2010版本10.0.30319.1

Minitab 16.1.0 Minitab 16.1.0

Thank you, Pablo 谢谢你,巴勃罗

Just a guess, based on something that happened to me ages ago: 只是基于几年前发生在我身上的事情做出的猜测:

For some reason, Minitab is displaying a modal error dialog of some kind. 由于某种原因,Minitab会显示某种模式错误对话框。 When you configure DCOM to launch as some user (not the interactive user), the process gets its own "windows station" which is not actually visible to you as the logged in user. 当您将DCOM配置为以某些用户 (而非交互用户)身份启动时 ,该进程将获得其自己的“ Windows工作站”,作为登录用户您实际上并不可见。 So there is a dialog popped up somewhere invisible, waiting for input forever, hence the hang. 因此,在不可见的地方会弹出一个对话框,永远等待输入,因此挂起。 Why the dialog is displaying is a different matter, likely a permissions issue. 为什么显示对话框是另一回事,可能是权限问题。 Sometimes, certain parts of the registry are available or not available in different activation contexts, for example. 例如,有时,注册表的某些部分在不同的激活上下文中可用或不可用。

Thanks Jlew for the link. 感谢Jlew提供的链接。 It helped me to solve the problem by changing a register value from “Shared Section=1024,20480,768” to “Shared Section=1024,20480, 2304 ” (3 times bigger) on this register key: HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\SubSystems\\Windows This value specifies a memory heap size when the user is not logged on. 它帮助我通过从“共享节= 1024,20480,768”对该寄存器密钥变更的寄存器值设定为“共享节= 1024,20480,2304”(大3倍),以解决该问题: HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\SubSystems\\Windows此值指定用户未登录时的内存堆大小。 I guess it was not enough to handle all the MiniTab graphs. 我想这还不足以处理所有MiniTab图。

Pablo 巴勃罗

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 基于具有相同令牌的方法调用,User.Identity不同 - User.Identity different based on method call with same token 如何检查[UserName]和[Password]的用户是否是[DomainName]的域管理员而没有模拟? - How to check if user with [UserName] and [Password] is domain administrator of [DomainName] without impersonation? C# 和 MVC 中的 System.Environment.Username 和 User.Identity.Name 有什么区别? - Whats the Difference between System.Environment.Username and User.Identity.Name in C# and MVC? 用户或管理员未同意使用该应用程序 - 为此用户和资源发送交互式授权请求 - The user or administrator has not consented to use the application - Send an interactive authorization request for this user and resource 内置帮助程序将User.Identity.Name解析为Domain \ Username - Built-in helper to parse User.Identity.Name into Domain\Username 允许用户使用Email或UserName(AspNet.Identity)登录 - Allow user to log in with either Email OR UserName (AspNet.Identity) 检查当前用户是否为管理员 - Check if the current user is administrator 如何在MVC中使用User.Identity.Name显示名称而不是UserName - How to display Name instead of UserName with User.Identity.Name in MVC 使用Asp.Net Identity更新用户 - 存在用户名 - Updating a user with Asp.Net Identity - username exists 管理员以用户身份验证 - Administrator Authenticate as User
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM