小编use*_*146的帖子

术语"更新 - 数据库"未被识别为cmdlet的名称

我正在使用EF5 beta1,而我之前能够运行"更新数据库".现在我关闭了Visual Studio,我无法让它运行.我收到以下错误:

术语"更新 - 数据库"未被识别为cmdlet,函数,脚本文件或可操作程序的名称.检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试.在行:1 char:16 + Update-Database <<<< -verbose + CategoryInfo:ObjectNotFound:(Update-Database:String)[],CommandNotFoundException + FullyQualifiedErrorId:CommandNotFoundException

我试图重新安装EF5b1并且虽然成功(已安装),但"更新数据库"仍然无效.

谁能帮忙???

entity-framework ef-code-first ef-migrations entity-framework-5

104
推荐指数
9
解决办法
8万
查看次数

JwtSecurityTokenHandler().ValidateToken()::签名验证失败...在此上下文中不支持sha256

我执行JwtSecurityTokenHandler()时遇到以下错误.ValidateToken()函数:

这是我的伪代码:

var jwtToken = {...}
var tokenHandler = new JwtSecurityTokenHandler();
var validationParameters = new TokenValidationParameters {...};
var claimsPrincipal = tokenHandler.ValidateToken(jwtToken, validationParameters);
Run Code Online (Sandbox Code Playgroud)

这是错误:

Jwt10316: Signature validation failed. Keys tried: 'System.IdentityModel.Tokens.X509AsymmetricSecurityKey'.
Exceptions caught:
 'System.InvalidOperationException: Jwt10518: AsymmetricSecurityKey.GetHashAlgorithmForSignature( 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256' ) threw an exception.
AsymmetricSecurityKey: 'System.IdentityModel.Tokens.X509AsymmetricSecurityKey'
SignatureAlgorithm: 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256', check to make sure the SignatureAlgorithm is supported.
Exception: 'System.NotSupportedException: Crypto algorithm 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256' not supported in this context.
   at System.IdentityModel.Tokens.X509AsymmetricSecurityKey.GetHashAlgorithmForSignature(String algorithm)
   at System.IdentityModel.Tokens.AsymmetricSignatureProvider..ctor(AsymmetricSecurityKey key, String algorithm, Boolean willCreateSignatures)'. 
---> System.NotSupportedException: Crypto algorithm 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256' not supported in …
Run Code Online (Sandbox Code Playgroud)

c# x509securitytokenmanager wif jwt

11
推荐指数
1
解决办法
1万
查看次数

是什么让FederatedAuthentication.SessionAuthenticationModule返回NULL?

我不确定为什么,但是当我尝试运行我的ClaimsTransformer()模块时,我的FederatedAuthentication.SessionAuthenticationModule解析为NULL并且崩溃我的应用程序:

    public void EstablishSession(ClaimsPrincipal principal)
    {
        var sessionToken = new SessionSecurityToken(principal, TimeSpan.FromHours(8))
        {
            IsPersistent = false, // make persistent
            IsReferenceMode = true // cache on server
        };


        FederatedAuthentication.SessionAuthenticationModule.WriteSessionTokenToCookie(sessionToken);
       // FederatedAuthentication.SessionAuthenticationModule == null and I throw an error :(
    }
Run Code Online (Sandbox Code Playgroud)

这是我的web.config中的内容:

<configSections>
  <section name="system.identityModel" type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
  <section name="system.identityModel.services" type="System.IdentityModel.Services.Configuration.SystemIdentityModelServicesSection, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</configSections>
<system.web>
  <authentication mode="None" />
</system.web>
<system.webServer>
  <modules runAllManagedModulesForAllRequests="true">
    <remove name="RoleManager" />
    <remove name="FormsAuthentication" />
    <remove name="SessionAuthenticationModule" />
    <add name="SessionAuthenticationModule" type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, …
Run Code Online (Sandbox Code Playgroud)

c# security federated-identity wif

7
推荐指数
1
解决办法
1万
查看次数

带有自定义标头的MVC重定向

希望对于那里的某个人来说,这是一个简单的问题.

基本上收到我的MVC控制器的请求后,我想:

  1. 在响应中添加"授权"标头
  2. 重定向到另一个域上的另一个应用程序
  3. 阅读此外部站点的"授权"标题.

它似乎是重定向,删除所有自定义标头和重定向的行为.

我的问题是,如何添加新标头,并执行重定向,并在接收主机[在重定向结束时]的标题中显示该标题?

c# model-view-controller asp.net-mvc http-headers asp.net-mvc-4

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