Tag: asp.net 4.5

“EnsureBindingRedirects”任务意外失败

错误,当我从vs2012创build新的ASP.NET 4.5网页表单应用程序,并更新所有nuget包..我在构build上收到此错误。 Error 1 The "EnsureBindingRedirects" task failed unexpectedly. System.NullReferenceException: Object reference not set to an instance of an object. at Roxel.BuildTasks.EnsureBindingRedirects.MergeBindingRedirectsFromElements(IEnumerable`1 dependentAssemblies) at Roxel.BuildTasks.EnsureBindingRedirects.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()

EntityFramework 5使用dll版本4.4.0.instead 5.0

我有基于.NET 4.0的项目,但我需要在我的解决scheme中使用EntityFramework 5。 所以我从NuGet安装它。 之后,我将目标框架更改为.NET 4.5(我正在使用VS 2012)并重build项目。 但在参考文件夹中,我看到该项目使用EntityFramework.dll版本4.4.0.0。 何可以使用更新版本的EntityFramework? 在web.config <compilation debug="true" targetFramework="4.5"> <assemblies> <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </assemblies> </compilation>

为什么我的ClaimsIdentity总是被authentication为false(对于web api授权filter)?

在Web API项目中,我重写了正常的身份validation过程来检查令牌。 代码看起来像这样: if ( true ) // validate the token or whatever here { var claims = new List<Claim>(); claims.Add( new Claim( ClaimTypes.Name, "MyUser" ) ); claims.Add( new Claim( ClaimTypes.NameIdentifier, "MyUserID" ) ); claims.Add( new Claim( ClaimTypes.Role, "MyRole" ) ); var claimsIdentity = new ClaimsIdentity( claims ); var principal = new ClaimsPrincipal( new[] { […]

在.NET 4.5中,我可以在C#5中做什么,而在.NET 4中,我无法在C#4中做这些?

我已经在Windows 8 Release Preview上安装了Visual Studio 2012 RC,我的问题是有没有与Metro有关的有用的新function,或者Metro是什么单独的.Net 4和.Net 4.5?

在Build Server上构build不带Visual Studio的ASP.NET 4.5

自从我安装了一个Build Server之后,我已经有一段时间了,所以也许我已经忘记了一些东西,或许.NET 4.5与我上次做的任何版本都不一样,但这是我的问题。 我试图build立一个构build服务器来监视一个源代码控制库。 无论什么时候改变,我想让服务器去修改并build立项目。 如果没有错误,我想将网站部署到生成服务器上运行的网站。 在过去,当我这样做,我以为我能够做到这一点只有NET安装,但是当我尝试build立这个项目,我得到一个错误,“C:\ Program Files \ MSBuild \微软\ VisualStudio的\ V11 .0 \ WebApplications \ Microsoft.WebApplication.targets“缺less,如果我去看看,我可以看到它缺less。 实际上没有Visual Studio 11的目标文件。 经过了很多的思考和搔头,我走出去,得到了“Windows 8 / .NET 4.5 SDK”认为NET 4.5 SDK可能会安装我需要的目标文件,但它没有,除非我错误地安装它的错误。 那么,为了让项目构build起来,我需要在Build Server上放置什么。 我宁愿不必安装完整的Visual Studio 2012。

将Visual Studio 2015中的Grunt,Bower,Gulp,NPM用于ASP.NET 4.5项目

Visual Studio 2015内置支持ASP.NET 5项目的Grunt,Bower,Gulp和NPM等工具。 但是,当我使用Visual Studio 2015创buildASP.NET 4.5.2项目时,它不使用这些工具。 我想使用bower而不是nuget来pipe理客户端软件包。 我可以在Visual Studio 2013中find有关使用这些工具的信息(例如,请参阅此问题)。 但是我猜这个过程对于Visual Studio 2015是不同的,因为它已经构build了对这些工具的支持。

Web API 2和.NET 4.5.1迁移后GlobalConfiguration.Configure()不存在

我最近开始遵循这个指南将我的项目迁移到.NET 4.5.1和Web Api 2。 MS开发人员Rick Anderson要求你做的第一件事就是改变: WebApiConfig.Register(GlobalConfiguration.Configuration); 至 GlobalConfiguration.Configure(WebApiConfig.Register); 在global.asax文件中。 然而,当我尝试构build时,这给了我一个错误: 错误1“System.Web.Http.GlobalConfiguration”不包含“configuration”的定义 我的项目目前在MVC 5和Web Api 2和.NET 4.5.1,但我认为System.Web.Http仍然认为它是.NEt 4.0版本。 我怎样才能解决这个问题? 谢谢。 编辑: 这是我的程序集绑定: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31BF3856AD364E35" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/> </dependentAssembly> <!– <dependentAssembly> <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect […]

IIS8中的IIS_IUSRS和IUSR权限

我刚刚从Win2003上的IIS6移到Win2012上的IIS8来托pipeASP.NET应用程序。 在我的应用程序的一个特定的文件夹中,我需要创build和删除文件。 将文件复制到新服务器后,当我试图删除文件时,我一直看到以下错误: 访问path“D:\ WebSites \ myapp.co.uk \ companydata \ filename.pdf”被拒绝。 当我检查IIS时,我发现应用程序正在DefaultAppPool帐户下运行,但是,我从来没有在此文件夹上设置Windows权限以包含IIS AppPool \ DefaultAppPool 相反,为了阻止尖叫客户,我授予了文件夹的以下权限: IUSR 阅读并执行 列出文件夹内容 读 写 IIS_IUSRS 修改 阅读并执行 列出文件夹内容 读 写 这似乎奏效了,但是我担心已经设置了太多的权限。 我在网上阅读了冲突的信息,关于IUSR是否真的需要在这里。 任何人都可以澄清哪些用户/权限就足够创build和删除该文件夹上的文件吗? 另外,IUSR是IIS_IUSRS组的一部分吗? 更新和解决scheme 请参阅下面的答案 。 我不得不这样做,因为最近的一些build议没有经过深思熟虑,甚至是安全的(IMO)。