草庐IT

global-namespace

全部标签

c# - IIs 错误 : Application Codebehind =“Global.asax.cs” Inherits =“nadeem.MvcApplication”

我正在尝试部署我的Web项目,但我不断收到此错误:Line1:我看了这篇文章:ParserError:ServerErrorin'/'Application但它在我的项目中是正确的。我怀疑它与我的iis7配置有关。有什么想法吗?全局.asax:Global.asax.cs:namespaceTamalTest{usingSystem;usingSystem.Web;usingSystem.Web.Mvc;usingSystem.Web.Routing;publicclassMvcApplication:HttpApplication{protectedvoidApplication_S

c# - ReferenceLoopHandling.Ignore 在 WebApi Global.asax 中不起作用

我有一个返回循环错误的API端点(因为它链接了一个循环返回的连接类),例如classA{virtualClassAB;}classB{virtualClassAB;}classAB{virtualClassA;virtualClassB;}在APIGET中,我需要从ClassA的角度返回ClassB的详细信息(在ClassBGET中反之亦然)。当我得到时,我会执行以下操作:IQueryableresults=_dbset.Include(x=>x.ClassAB).Include(x=>x.ClassAB.Select(y=>y.ClassB)).AsExpandable().Wher

c# - 将 global.asax 迁移到 ASP.NET 5

几天前.NETCoreRC1发布了,我在阅读了很多有关它的资料后第一次尝试了它,我喜欢它,但它有点不同。我正在尝试将一个小型博客(内置于MVC5)迁移到MVC6和.NETCore。这并不难,但我真的很难重新创建与MVC5中完全相同的global.asax设置,ASP.NET5不再具有global.asax,所以我无法弄清楚大多数设置的替代品是吗?protectedvoidApplication_Start(){ViewEngines.Engines.Clear();ViewEngines.Engines.Add(newRazorViewEngine());MvcHandler.Disa

c# - 查询 XmlDocument 而不会出现 'Namespace prefix is not defined' 问题

我有一个Xml文档,它定义并引用了一些命名空间。我将它加载到一个XmlDocument对象中,据我所知,我创建了一个XmlNamespaceManager对象,用于查询Xpath。问题是我收到XPath异常,表示命名空间“my”未定义。如何让命名空间管理器看到我引用的命名空间已经定义。或者更确切地说,如何将命名空间定义从文档获取到命名空间管理器。此外,令我感到奇怪的是,您必须首先为从文档命名表创建的文档提供命名空间管理器。即使您需要硬编码手动命名空间,为什么不能将它们直接添加到文档中。为什么每次查询都必须传递这个namespace管理器?XmlDocument不能知道什么?代码:Xml

c# - "Both use the XML type name X, use XML attributes to specify a unique XML name and/or namespace for the type"怎么解决?

我有以下枚举定义...namespaceItemTable{publicenumDisplayMode{Tiles,Default}}namespaceEffectiveItemPermissionTable{publicenumDisplayMode{Tree,FullPaths}}...然后我有以下类(class)...publicclassTablewhereTDisplayMode:struct{//publicpublicTDisplayModeDisplayMode{get{returnmDisplayMode;}set{mDisplayMode=value;}}//pri

c# - 选择 namespace 名称时我应该知道什么?

我的任务是选择一个名称,该名称实际上将成为我们架构的内部名称。我正在认真对待这一责任,因为我曾使用过很多“坏”命名空间,不想将其强加于他人。什么对我来说是“糟糕的”命名空间?在人为因素方面:基本无意义的首字母缩略词:DDL、MOS等与其他供应商的通用命名空间冲突的命名空间,例如Office或Text或IO对于非英语母语者而言难以拼写或发音的namespace,因为它是外来词或专有名词:Vancouver等等。在描述能力和助记性方面,我觉得选择命名空间很舒服。我想知道命名空间名称的技术后果是什么。例如,命名空间_是合法的C#命名空间名称,可能会出现什么问题?单个字母怎么样,比如e?是否有

c# - 如何处理 global.asax 中的 session 结束?

我在聊天应用程序中工作,我使用HashTable将User和Operator作为ChatRoom类的键和对象作为HashTable的值。主要问题是当用户或运算符(operator)关闭浏览器或断开连接而不注销时,它会在session结束时自动注销。请帮助我解决这个问题以及如何在这件事上使用Global.asax。 最佳答案 您可以使用global.asax的session结束事件来删除意外断开连接的用户:voidSession_End(Objectsender,EventArgsE){//Cleanupsessionresource

c# - 捕捉 Global.asax 中的错误

我的Global.asax中有以下内容用于处理错误:voidApplication_Error(objectsender,EventArgse){Exceptionexception=Server.GetLastError();if(exception!=null){//Logif(HttpContext.Current.Server!=null){HttpContext.Current.Server.Transfer("/siteerror.aspx");}}}这在大多数情况下都有效,但有时无法进入Server.Transfer。由于某种原因HttpContext.Current.S

c# - 有没有办法通过 C# 代码获取类中所有 namespace 'using'?

有什么方法可以得到List其中包含namespace/类中的所有“使用”?例如usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Linq.Expressions;usingSystem.Linq.Dynamic;usingSystem.Text.RegularExpressions;usingSystem.Reflection;namespaceMyNamespace.Other.Scripting{我会有一个包含“System”、“System.Text”

c# - 尽管 namespace 中存在类,但获取 XMLNS 名称未找到错误

我正在尝试从xceed.wpf.Toolkit命名空间引用IntegerUpdown。当我使用对象浏览器时,我可以看到IntegerUpdown但在构建时出现错误:Error15Thename"IntegerUpDown"doesnotexistinthenamespace"clr-namespace:Xceed.Wpf.Toolkit;assembly=WPFToolkit.Extended". 最佳答案 WPFToolKit定义了别名或自定义命名空间http://schemas.xceed.com/wpf/xaml/toolki