积极答复者
关于Session的SqlState模式问题

问题
答案
-
你好,
试试二进制反序列化http://msdn.microsoft.com/zh-cn/library/bb738528.aspx
Microsoft Online Community Support- 已标记为答案 KeFang Chen 2010年6月14日 6:27
-
问题1自行解决了.呵呵.
代码如下:
<%@ Page Language="C#" %> <%@ Import Namespace="System.Web.Hosting" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Page_PreRender(object sender, EventArgs e) { ApplicationManager appManager = ApplicationManager.GetApplicationManager(); ApplicationInfo [] appInfo = appManager.GetRunningApplications(); GridView1.DataSource = appInfo; GridView1.DataBind(); } </script> <html > <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Application Info sample</title> </head> <body> <form id="form1" runat="server"> <asp:GridView ID="GridView1" runat="server"> </asp:GridView> </form> </body> </html>
- 已标记为答案 KeFang Chen 2010年6月14日 6:27
-
额.
终于查到我想要的了..
嘿嘿.
代码如下:AppDomain.CurrentDomain.FriendlyName
感谢KeFang Chen <abbr class="affil">MSFT</abbr> <abbr class="affil">, 版主.</abbr>
根据你的提示我补习了下 ASP.NET运行机制.关于宿主、ASP.NET应用程序域和等方面的知识.
原来我想问的其实应该是当前页面所在的应用程序域的ID如何获取.
该标识值的模式就是 /lm/w3svc/1/root/...这个类似的格式.
另附其他一些 "当前"信息 的获取代码.
// Put user code to initialize the page here
this .ApplicationId = ((HowAspNetWorks.Global)
HttpContext.Current.ApplicationInstance).ApplicationId;
this .ThreadId = AppDomain.GetCurrentThreadId();
this .DomainId =
AppDomain.CurrentDomain.FriendlyName;
this .ThreadInfo = "ThreadPool Thread: " +
Thread.CurrentThread.IsThreadPoolThread.ToString() +
" < br > Thread Apartment: " +
Thread.CurrentThread.ApartmentState.ToString();
// *** 为了可以同时看到多个请求一起到 达,故意放慢速度
Thread.Sleep(3000);
参考:http://hi.baidu.com/qingfeng_suifeng/blog/item/1400b9139afc2ed9f6039eb6.html- 已标记为答案 GodOMG 2010年6月14日 9:40
全部回复
-
问题1自行解决了.呵呵.
代码如下:
<%@ Page Language="C#" %> <%@ Import Namespace="System.Web.Hosting" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Page_PreRender(object sender, EventArgs e) { ApplicationManager appManager = ApplicationManager.GetApplicationManager(); ApplicationInfo [] appInfo = appManager.GetRunningApplications(); GridView1.DataSource = appInfo; GridView1.DataBind(); } </script> <html > <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Application Info sample</title> </head> <body> <form id="form1" runat="server"> <asp:GridView ID="GridView1" runat="server"> </asp:GridView> </form> </body> </html>
- 已标记为答案 KeFang Chen 2010年6月14日 6:27
-
你好,
试试二进制反序列化http://msdn.microsoft.com/zh-cn/library/bb738528.aspx
Microsoft Online Community Support- 已标记为答案 KeFang Chen 2010年6月14日 6:27
-
你好,KeFang Chen.
第二个问题我已经找到个解释得更好的了.嘿嘿.
http://www.cnblogs.com/squirrel_sc/archive/2004/12/28/82938.html
另外对于第一个问题.
我有点疑惑.
只能通过ApplicationManager.GetApplicationManager()对象的GetRunningApplications()函数获得ApplicationInfo的类的数组对象方式吗?
难道获取当前站点的唯一标识和路径可以有多个?
代码如下.
是否有其他的方法?
这个最后获取回来的ApplicationInfo对象是数组的模式另我非常疑惑.
难道不是获取的当前网页所属的站点?而是整个IIS(6.0+)的所有站点的ApplicationInfo对象?
ApplicationManager appManager = ApplicationManager.GetApplicationManager();
ApplicationInfo [] appInfo = appManager.GetRunningApplications();
- 已标记为答案 KeFang Chen 2010年6月14日 6:27
- 取消答案标记 GodOMG 2010年6月14日 8:53
-
ApplicationManager是为 ASP.NET 宿主应用程序管理 ASP.NET 应用程序域,并不是IIS,而是为IIS管理应用程序域。
它获取的应该是整个应用程序域内的applicationInfor。
详情可以参考下面的文档:
http://msdn.microsoft.com/zh-cn/library/system.web.hosting.applicationmanager(v=VS.80).aspx
http://msdn.microsoft.com/zh-cn/library/system.web.hosting.applicationmanager_members(v=VS.80).aspx
Microsoft Online Community Support -
额.
终于查到我想要的了..
嘿嘿.
代码如下:AppDomain.CurrentDomain.FriendlyName
感谢KeFang Chen <abbr class="affil">MSFT</abbr> <abbr class="affil">, 版主.</abbr>
根据你的提示我补习了下 ASP.NET运行机制.关于宿主、ASP.NET应用程序域和等方面的知识.
原来我想问的其实应该是当前页面所在的应用程序域的ID如何获取.
该标识值的模式就是 /lm/w3svc/1/root/...这个类似的格式.
另附其他一些 "当前"信息 的获取代码.
// Put user code to initialize the page here
this .ApplicationId = ((HowAspNetWorks.Global)
HttpContext.Current.ApplicationInstance).ApplicationId;
this .ThreadId = AppDomain.GetCurrentThreadId();
this .DomainId =
AppDomain.CurrentDomain.FriendlyName;
this .ThreadInfo = "ThreadPool Thread: " +
Thread.CurrentThread.IsThreadPoolThread.ToString() +
" < br > Thread Apartment: " +
Thread.CurrentThread.ApartmentState.ToString();
// *** 为了可以同时看到多个请求一起到 达,故意放慢速度
Thread.Sleep(3000);
参考:http://hi.baidu.com/qingfeng_suifeng/blog/item/1400b9139afc2ed9f6039eb6.html- 已标记为答案 GodOMG 2010年6月14日 9:40
-
你好,KeFang Chen <abbr class="affil">MSFT</abbr> <abbr class="affil">, 版主.</abbr>
可不可以这样理解.
在IIS6.0中.
应用程序域就相当于应用程序池.
多个站点或者虚拟目录可以配置在同一个应用程序池里,也可以都单独开辟一个应用程序池.