我有一个连接到SignalR 2.0后端的Windows客户端,现在我也试图让它连接到ASP.NET Web API 2.1后端.
我用来与web api通信的库依赖于Newtonsoft.Json 6.0.0.0,但Microsoft.AspNet.SignalR.Client 2.0.0.0似乎依赖于Newtonsoft.Json 4.5.0.0.
由于这是一个Windows客户端,因此dll文件最终位于同一目录中,并且只有两个所需版本中的一个将最终在磁盘上,使得signalr-client或HttpClient无法加载其版本的Newtonsoft.Json dll文件.
如果6.*版本在磁盘上,则SignalR错误:
Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0,
Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' 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)
是否有可能使SignalR使用较新版本的Newtonsoft或能够在同一解决方案中使用这两个版本?
请记住,我对Nuget包装和SignalR似乎使用的隐式引用非常新...
解决方案: 我用版本6.0替换了signalR客户端库中的Newtonsoft引用,并将下面由Kiran Challa编写的程序集重定向添加到库的App.config以及可执行项目的app.config,现在这两个库寻找并加载相同的组件.
我已更新到Skype for Business 2016(Office 2016),我正在开发的桌面应用程序与Lync客户端集成,已经开始抛出异常.
我猜测SDK版本15.0.4481.100与Skype for Business版本16.0.42.66.1003不兼容,但我找不到比Lync 2013 SDK更新的SDK(2014-03-17).
Skype for Business 2016的桌面客户端开发是否不像2013年那样受支持?
例外:Unable to cast COM object of type 'System.__ComObject' to interface type
'Microsoft.Office.Uc.IAudioDevice2'. This operation failed because the QueryInterface call
on the COM component for the interface with IID '{86B3E5FE-4635-4C1E-A725-C80B71D04984}'
failed due to the following error: No such interface supported
(Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
Run Code Online (Sandbox Code Playgroud)
LyncClient.GetClient( sideBySide ).DeviceManager.AudioDevices
Run Code Online (Sandbox Code Playgroud)
当我遍历音频设备时会发生异常.使用嵌入式(UI Supressed)S4B客户端启动和接受呼叫时,sideByside不会.我原来问题的答案似乎是肯定的,但并不完全!
我希望将用户授权基于 Web API 中的 Azure AD 应用程序角色,但这些角色不会转换为实际声明,即使我可以在令牌验证响应中看到它们。
我可以在ClaimsPrincipal.Current.Claims列表中看到角色,但在属性名称Roles下,而不是声明架构http://schemas.microsoft.com/ws/2008/06/identity/claims/role。
我已设法通过将RoleClaimType设置为"roles"来获取 Authorization 属性来识别角色。
但是如何让 Azure 返回角色,或者配置 API 来解释它们,以便HasClaim(ClaimTypes.Role, "AdminRole")返回 true?
控制器.cs
[Authorize(Roles = "AdminRole")]
public IEnumerable<Item> Get()
{
var a = ClaimsPrincipal.Current.HasClaim( ClaimTypes.Role, "AdminRole" ); // false
var b = User.IsInRole( "AdminRole" ); // true
}
Run Code Online (Sandbox Code Playgroud)
启动.cs
public void ConfigureAuth( IAppBuilder app )
{
app.UseWindowsAzureActiveDirectoryBearerAuthentication(
new WindowsAzureActiveDirectoryBearerAuthenticationOptions
{
Tenant = ConfigurationManager.AppSettings[ "ida:Tenant" ],
TokenValidationParameters =
new TokenValidationParameters
{
ValidAudience = ConfigurationManager.AppSettings[ "ida:Audience" …Run Code Online (Sandbox Code Playgroud) ASP.NET Core SignalR 服务器是否向后兼容 ASP.NET SignalR 客户端?
我有一个基于旧 ASP.NET SignalR 和 PersistentConnection 的服务器实现,我想移动到 ASP.NET Core,但旧客户端仍然必须能够连接到新的服务器平台 - 升级客户端是一个缓慢的过程。
这是一个普遍的问题,我认为它应该有自己的帖子,而不会出现混乱的代码。
我正在尝试从 Structuremap 2.6.4.1 移动到 3.1.4.143,但无法弄清楚如何处理 HybridHttpOrThreadLocalScoped。没有一个 SO Q/AI 可以找到似乎对我有用......
我有以下代码:
using StructureMap;
using StructureMap.Web;
ObjectFactory.Configure( x =>
{
x.For<IRepository<Person>>()
.HybridHttpOrThreadLocalScoped() // Need the repo to survive for the duration of the thread!
.Use<Repository_Stub<Person>>()
.Ctor<IEnumerable<IEntity>>( "seed" ).Is( persons );
} );
Run Code Online (Sandbox Code Playgroud)
这给了我这个错误:
'StructureMap.Configuration.DSL.Expressions.CreatePluginFamilyExpression<IRepository<Person>>'
does not contain a definition for 'HybridHttpOrThreadLocalScoped' and no extension method
'HybridHttpOrThreadLocalScoped' accepting a first argument of type
StructureMap.Configuration.DSL.Expressions.CreatePluginFamilyExpression<IRepository<Person>>'
could be found (are you missing a using directive or an assembly reference?)
Run Code Online (Sandbox Code Playgroud)
是否有调用 HybridHttpOrThreadLocalScoped 的新方法?
提前致谢!