草庐IT

current_direction

全部标签

c# - 随机程序集引用失败 ("Are you missing a using directive or an assembly reference?")

我的应用程序混合了3.5和4.0目标程序集。我正在开发一项针对4.0的新Windows服务,该项目突然似乎无法在解决方案中看到其他一些程序集。这意味着,在构建时,对这些特定其他程序集的所有引用都会产生以下错误:Thetypeornamespacename'[X]'doesnotexistinthenamespace'[Y]'(areyoumissinganassemblyreference?)如果我删除项目引用并重新添加它,红色波浪线就会消失,Intellisense会像预期的那样再次启动。解决方案中的所有其他项目都可以毫无问题地构建。但是当我尝试构建这个新项目时,错误又回来了。其中一

c# - 随机程序集引用失败 ("Are you missing a using directive or an assembly reference?")

我的应用程序混合了3.5和4.0目标程序集。我正在开发一项针对4.0的新Windows服务,该项目突然似乎无法在解决方案中看到其他一些程序集。这意味着,在构建时,对这些特定其他程序集的所有引用都会产生以下错误:Thetypeornamespacename'[X]'doesnotexistinthenamespace'[Y]'(areyoumissinganassemblyreference?)如果我删除项目引用并重新添加它,红色波浪线就会消失,Intellisense会像预期的那样再次启动。解决方案中的所有其他项目都可以毫无问题地构建。但是当我尝试构建这个新项目时,错误又回来了。其中一

c# - 将 HttpContext.Current.User 与异步等待一起使用的正确方法

我正在使用异步操作并像这样使用HttpContext.Current.UserpublicclassUserService:IUserService{publicILocPrincipalCurrent{get{returnHttpContext.Current.UserasILocPrincipal;}}}publicclassChannelService:IDisposable{//IntheservicelayerpublicChannelService():this(newEntities.LocDbContext(),newUserService()){}publicChan

c# - 将 HttpContext.Current.User 与异步等待一起使用的正确方法

我正在使用异步操作并像这样使用HttpContext.Current.UserpublicclassUserService:IUserService{publicILocPrincipalCurrent{get{returnHttpContext.Current.UserasILocPrincipal;}}}publicclassChannelService:IDisposable{//IntheservicelayerpublicChannelService():this(newEntities.LocDbContext(),newUserService()){}publicChan

c# - HttpContext.Current.Cache.Insert 和 HttpContext.Current.Cache.Add 有什么区别

我正在开发一个ASP.NETweb应用程序,我想实现缓存,所以我想知道HttpContext.Current.Cache.Insert和HttpContext.Current之间的区别.Cache.Add哪个更好? 最佳答案 两者之间的主要区别在于,如果缓存中已存在同名对象,则对Cache实例调用的Insert方法将替换对象,而Add方法调用将失败(取自Add和Insert方法在其各自的MSDN引用页上的Remarks段落):添加Callstothismethodwillfailifanitemwiththesamekeyparam

c# - HttpContext.Current.Cache.Insert 和 HttpContext.Current.Cache.Add 有什么区别

我正在开发一个ASP.NETweb应用程序,我想实现缓存,所以我想知道HttpContext.Current.Cache.Insert和HttpContext.Current之间的区别.Cache.Add哪个更好? 最佳答案 两者之间的主要区别在于,如果缓存中已存在同名对象,则对Cache实例调用的Insert方法将替换对象,而Add方法调用将失败(取自Add和Insert方法在其各自的MSDN引用页上的Remarks段落):添加Callstothismethodwillfailifanitemwiththesamekeyparam

c# - 单元测试 HttpContext.Current.Cache 或 C# 中的其他服务器端方法?

为使用HttpContext.Current.Cacheclass的类创建单元测试时,我在使用NUnit时出错。功能是基本的-检查一个项目是否在缓存中,如果不在,则创建它并将其放入:if(HttpContext.Current.Cache["Some_Key"]==null){myObject=newObject();HttpContext.Current.Cache.Insert("Some_Key",myObject);}else{myObject=HttpContext.Current.Cache.Get("Some_Key");}从单元测试中调用它时,遇到第一个Cache行时会

c# - 单元测试 HttpContext.Current.Cache 或 C# 中的其他服务器端方法?

为使用HttpContext.Current.Cacheclass的类创建单元测试时,我在使用NUnit时出错。功能是基本的-检查一个项目是否在缓存中,如果不在,则创建它并将其放入:if(HttpContext.Current.Cache["Some_Key"]==null){myObject=newObject();HttpContext.Current.Cache.Insert("Some_Key",myObject);}else{myObject=HttpContext.Current.Cache.Get("Some_Key");}从单元测试中调用它时,遇到第一个Cache行时会

c# - HttpContext.Current 未在 MVC 4 项目中解析

我想使用ImageResizer(来自ImageResizingdotnet)。我通过NuGet为MVC安装了ImageResizer。但是当我去使用示例中的以下代码时://Loopthrougheachuploadedfileforeach(stringfileKeyinHttpContext.Current.Request.Files.Keys){HttpPostedFilefile=HttpContext.Current.Request.Files[fileKey];if(file.ContentLengthand,or//evenasantiziedversionoftheor

c# - HttpContext.Current 未在 MVC 4 项目中解析

我想使用ImageResizer(来自ImageResizingdotnet)。我通过NuGet为MVC安装了ImageResizer。但是当我去使用示例中的以下代码时://Loopthrougheachuploadedfileforeach(stringfileKeyinHttpContext.Current.Request.Files.Keys){HttpPostedFilefile=HttpContext.Current.Request.Files[fileKey];if(file.ContentLengthand,or//evenasantiziedversionoftheor