小编edy*_*mtt的帖子

为什么ASP.NET MVC会使用会话状态?

ASP.NET团队建议使用缓存而不是会话,我们在过去几年中停止使用会话来处理WebForm模型.所以我们通常在web.config中关闭会话

<sessionState mode="Off" />
Run Code Online (Sandbox Code Playgroud)

但是,现在当我使用此设置测试ASP.NET MVC应用程序时,它会SessionStateTempDataProvider在mvc框架内的类中抛出错误,它要求我打开会话状态,我做了并且它有效.查看它使用会话的来源:

// line 20 in SessionStateTempDataProvider.cs
Dictionary<string, object> tempDataDictionary = 
httpContext.Session[TempDataSessionStateKey] as Dictionary<string, object>; 
Run Code Online (Sandbox Code Playgroud)

那么,为什么他们会在这里使用会话?我错过了什么?

================================================== ======

编辑对不起这篇文章不是故意讨论会话与缓存,而是在ASP.NET MVC的上下文中,我只是想知道为什么会话在这里使用.在这篇文中,Scott Watermasysk也提到关闭会话是一个很好的做法,所以我只是想知道为什么我必须从这里开启使用MVC.

asp.net-mvc session-state

33
推荐指数
3
解决办法
5万
查看次数

如何使用Nuget.exe更新包

对于我在.NET中的小样本项目(直接在命令行上构建而不使用Visual Studio),我想直接使用它Nuget.exe来检索我需要的库,而不必在源存储库中提交它们.

我已经能够使用该命令安装它们

nuget install packages.config -o $destinationFolder
Run Code Online (Sandbox Code Playgroud)

指定所需的包packages.config(如Visual Studio中的Nuget).但是,我无法更新已安装的软件包.我试过用这个命令

nuget update packages.config -r $destinationFolder
Run Code Online (Sandbox Code Playgroud)

Nuget.exe抱怨是

unable to locate project file for '...packages.config'`.
Run Code Online (Sandbox Code Playgroud)

我在互联网上搜索过,但我只在Nuget论坛上找到了类似的问题而没有答案.

nuget

6
推荐指数
1
解决办法
2998
查看次数

加载Azure存储2.0时出错 - 无法加载Microsoft.Data.OData 5.0.2

我的托管服务使用Azure Storage 2.0(来自Nuget的2.0.5.1).在Visual Studio 2010下我没有问题.我切换到Visual Studio 2012,现在在我的主要Web角色的某个网站上,我得到以下类型的异常Microsoft.WindowsAzure.Storage.StorageException:

Could not load file or assembly 'Microsoft.Data.OData, Version=5.0.2.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
The located assembly's manifest definition does not match
the assembly reference. (Exception from HRESULT: 0x80131040)
Run Code Online (Sandbox Code Playgroud)

而Azure Storage 2.0.5.1需要Microsoft.Data.OData5.2.0.0.其他工作者角色工作正常,他们似乎找到了正确的程序集.在每个项目中,Azure Storage 2.0都是从Nuget安装的,所有引用都指向该packages文件夹.

我在.NET 4.0下使用Azure SDK 1.8 - 这意味着我还使用Azure Storage Client 1.7.

.net azure azure-storage nuget visual-studio-2012

5
推荐指数
1
解决办法
4402
查看次数

转换为.NET 4.5后,TableAttribute在命名空间System.ComponentModel.DataAnnotations.Schema中不明确

我已经转换了ASP.net MVC 4项目从.NET 4.0到.NET 4.5下在此介绍的技术SO回答 -尤其是在vbproj文件我已经设置TargetFrameworkv4.5Prefer32Bitfalse.

我现在在Entity Framework模型中得到以下错误(继承自MVC模板项目)

TableAttribute is ambiguous in the namespace
System.ComponentModel.DataAnnotations.Schema
Run Code Online (Sandbox Code Playgroud)

使用对象资源管理器我已经看到TableAttribute了目前的程序集System.ComponentModel.DataAnnotations.dll(取自参考程序集)和EntityFramework.dll(取自从NuGet安装的Entity Framework 5).

.net vb.net asp.net-mvc entity-framework

5
推荐指数
1
解决办法
3817
查看次数