获取错误“此版本的SQL Server不支持用户实例登录标志”。但不使用此标志 [英] Getting error "The user instance login flag is not supported on this version of SQL Server." but not using this flag
问题描述
我最近升级了我正在本地使用SQL Server 2012 Developer的SQL Server Express数据库。我开始收到这个错误。一个快速的搜索引起了大量的帖子,其中的答案似乎是从连接字符串中删除 User Instance = True;
。
I recently upgraded a SQL Server Express database I was using locally to SQL Server 2012 Developer. I started getting this error. A quick search pulls up tons of posts where the answer seems to be to remove User Instance=True;
from your connection strings.
我检查过,我的连接字符串都没有这个标志。我尝试搜索整个解决方案的用户实例只是为了确保双重,它不会显示在任何地方。很奇怪的是我马上没有得到这个错误。第一对夫妇打电话给数据库工作...
I checked and none of my connection strings have this flag. I tried searching the entire solution for "user instance" just to make double sure and it doesn't show up anywhere. Doubly weird is that I don't get this error right away. The first couple calls to the database work...
有没有其他人有类似的经历?
Has anyone else had a similar experience?
是导致我错误的确切代码:
Here is the exact code that is causing my error:
public class BetterAuthorizeAttribute : AuthorizeAttribute
{
public override void OnAuthorization(System.Web.Mvc.AuthorizationContext filterContext)
{
var roleList = Roles.Split(',');
//if the user is in one of the roles in the list
foreach (string r in roleList)
{
if (filterContext.HttpContext.User.Identity.IsAuthenticated)
{
//The error is consistently thrown here the second time this line
//executes...
if (filterContext.HttpContext.User.IsInRole(r.Trim()))
{
以下是我认为相关的配置部分:
Here are the config sections I thought were relevant:
<connectionStrings>
<add name="BioSphereContext"
providerName="System.Data.SqlClient"
connectionString="Server=fake;Database=fake;User ID=fake;Password=fake;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;MultipleActiveResultSets=true;" />
</connectionStrings>
.
.
.
<sessionState mode="InProc" customProvider="DefaultSessionProvider" timeout="15">
<providers>
<add name="DefaultSessionProvider"
type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</sessionState>
.
.
.
<entityFramework>
<defaultConnectionFactory
type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
<parameters>
<parameter value="Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
有关我的项目的更多详细信息,以帮助...
Some more details about my project in case it helps...
- VS 2012
- 实体框架5
- Azure SDK 2.0
- ASP.NET MVC 3
- .net 4.5
- VS 2012
- Entity Framework 5
- Azure SDK 2.0
- ASP.NET MVC 3
- .net 4.5
推荐答案
不知道是什么问题,但我删除并重新克隆了我的git仓库。错误消失了....从来没有得到那天回来...哈哈。我会离开这个帖子,以防其中任何一个对他人有帮助。
Not sure what was wrong, but I deleted and re-cloned my git repository. Error went away.... never getting that day back... lol. I'll leave the post in case any of this is helpful to others.
这篇关于获取错误“此版本的SQL Server不支持用户实例登录标志”。但不使用此标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!