我已经失去了从Resharper 10(VS2015,VS2013)测试运行器运行或调试测试的能力.
Resharper - 单元测试运行器无法运行测试(System.Runtime.Remoting.RemotingException)找到两个与同一URI关联的对象.
清洁/重建/重启没有帮助.
我遇到以下问题:
尝试添加对Silverlight 5应用程序([MSDN] [1])的编码UI测试的支持.第一步是在Silverlight 5项目中引用程序集Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll.不幸的是,在添加引用之后,项目停止编译时出现了许多类似的错误:
>
Error 25 Cannot resolve reference assemblies. Please check the reference assemblies. Could not load file or assembly 'System.Core, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) ....\ErrorReportDialog.xaml
Looks like System.Core 5.0.5.0 fails to load, okay, debugging assemblies loading with Fuslogw produces two interesting logs:
First log:
> Assembly Binder Log Entry (04.03.2013 @ 14:07:49)
The operation was successful.
Bind …Run Code Online (Sandbox Code Playgroud) 我SecurityScheme对 java SpringBoot RESTful 应用程序使用 springdoc-openapi有以下定义:
@Bean
public OpenAPI customOpenAPI() {
return new OpenAPI()
.components(new Components().addSecuritySchemes("bearer-jwt",
new SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("bearer").bearerFormat("JWT")
.in(SecurityScheme.In.HEADER).name("Authorization")))
.info(new Info().title("App API").version("snapshot"));
}
Run Code Online (Sandbox Code Playgroud)
是否可以将其全局应用于所有路径,而不必在代码中的任何地方添加@SecurityRequirement注释@Operation?
如果是,如何向不安全的路径添加排除项?
当使用NHibernate Mapping By Code时,我对Cascade枚举选项行为有疑问.
Enum有以下选项:
[Flags]
public enum Cascade
{
None = 0,
Persist = 2,
Refresh = 4,
Merge = 8,
Remove = 16,
Detach = 32,
ReAttach = 64,
DeleteOrphans = 128,
All = 256,
}
Run Code Online (Sandbox Code Playgroud)
它们的目的是像位标志组合一样使用(据我所知).
我通过NHibernate文档查看过,并在那里定义了以下用于XML映射的级联选项:生命周期和对象图
任何人都可以通过代码描述来自新Nhibernate映射的级联选项吗?其中一半是自我描述,另一半则不是.
环境:
应用程序(用C#编写的.Net 4)最多有10个线程,每个线程都在自己的AppDomain中运行.每个线程都使用ADO.Net DataReader从SQL-Server 2008上获取存储过程的结果.另外一个线程可以使用ADO.Net来执行写操作(Bulk Insert).一切都在本地机器上运行.
问题#1:
偶尔(大约每30次运行)线程的执行会急剧减慢.当DataReader获取存储过程结果时会发生这种情况 - SqlCommand.ExecuteReader().通常读操作在10秒内执行.当它减速时,它会在10-20分钟内执行.SQLProfiler显示正在查询数据,但速度非常慢.
缓和的调用堆栈(请注意,没有例外):
at SNIReadSync(SNI_Conn* , SNI_Packet** , Int32 )
at SNINativeMethodWrapper.SNIReadSync(SafeHandle pConn, IntPtr& packet, Int32 timeout)
at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket()
at System.Data.SqlClient.TdsParserStateObject.ReadBuffer()
at System.Data.SqlClient.TdsParserStateObject.ReadByteArray(Byte[] buff, Int32 offset, Int32 len)
at System.Data.SqlClient.TdsParserStateObject.ReadString(Int32 length)
at System.Data.SqlClient.TdsParser.ReadSqlStringValue(SqlBuffer value, Byte type, Int32 length, Encoding encoding, Boolean isPlp, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.ReadSqlValue(SqlBuffer value, SqlMetaDataPriv md, Int32 length, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ReadColumnData()
at System.Data.SqlClient.SqlDataReader.ReadColumnHeader(Int32 i)
at System.Data.SqlClient.SqlDataReader.ReadColumn(Int32 i, Boolean setTimeout)
at System.Data.SqlClient.SqlDataReader.GetValueInternal(Int32 i)
at …Run Code Online (Sandbox Code Playgroud) 要求:
代码:已实现
@EnableWebSecurity
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/swagger-resources/*", "*.html", "/api/v1/swagger.json")
.hasAuthority("SWAGGER")
.anyRequest().permitAll()
.and()
.httpBasic()
.and()
.csrf().disable();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("admin").password("admin").authorities("SWAGGER");
}
}
Run Code Online (Sandbox Code Playgroud)
但是,此代码不起作用 - 您可以在没有任何身份验证的情况下自由浏览 /swagger-ui.html#/。
问题是 - 为什么 BASIC auth 和 user 不适用于 swagger ui 端点?
我会形容我的环境:我有Ninject + Ninject拦截扩展合作,以使所有的方法,标有特殊属性的拦截器自动注册.这是一个常见的AoP +属性+ DI容器场景.
我的问题是:当移植到Ninject和Ninject拦截扩展的最新版本 - 3.0我开始变得异常时,我的拦截器应该运行.我的InterceptorRegistrationStrategy在解析属性类型和注册拦截器时工作正常.但运行截获的方法会导致以下异常:
System.ArgumentException : Interface not found.
at System.RuntimeTypeHandle.VerifyInterfaceIsImplemented(RuntimeTypeHandle handle, RuntimeTypeHandle interfaceHandle)
at System.RuntimeType.GetInterfaceMap(Type ifaceType)
at Ninject.Extensions.Interception.Advice.Advice.MatchesMethod(IProxyRequest request)
at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList(IEnumerable`1 source)
at Ninject.Extensions.Interception.Registry.AdviceRegistry.GetInterceptorsForRequest(IProxyRequest request)
at Ninject.Extensions.Interception.Registry.AdviceRegistry.GetInterceptors(IProxyRequest request)
at Ninject.Extensions.Interception.Wrapper.StandardWrapper.CreateInvocation(IProxyRequest request)
at Ninject.Extensions.Interception.Wrapper.DynamicProxyWrapper.Intercept(IInvocation castleInvocation)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Infrastructure.Tests.Persistance.Conversations.NinjectConversationInterceptorBehavior.ShouldCreateInterceptorOnImplicitConversation() in NinjectConversationInterceptorBehavior.cs: line 74
Run Code Online (Sandbox Code Playgroud)
我有点左诉诸反射器,并使用Ninject拦截扩展来源做些什么这个问题,没有足够的文档,它让我在一个糟糕的位置配对.
移植到Ninject 3.0时,任何人都有同样的例外吗?
这是我用来根据属性自动注册拦截器的代码:
public class NinjectConversationInterceptorRegistrationStrategy : InterceptorRegistrationStrategy
{
public NinjectConversationInterceptorRegistrationStrategy(IAdviceFactory adviceFactory,
IAdviceRegistry adviceRegistry)
: base(adviceFactory, adviceRegistry)
{
}
public override void Execute(IPlan plan)
{
var pcAttribute …Run Code Online (Sandbox Code Playgroud) aop ninject interceptor ninject-extensions ninject-interception
我正在使用 .Net - mongodb c# monngodb 驱动程序。插入文档时,我想将生成的[BsonId] ObjectId Id字段复制到文档中的另一个字段(复制值)
我可以运行 Insert,它将生成密钥,然后运行 update 将密钥复制到另一个字段,但这将使数据库在(短暂的)一段时间内处于“软”状态。
是否可以“原子地”执行此操作,或者我使用 mongodb 是否错误?
我有一个使用 mongodb 作为底层存储的 RESTful 后端。我正在使用 c# 驱动程序。文档说明 mongo 自行管理其连接池。
问题是:要与 mongodb 通信,我需要以下实现的实例
IMongoClientIMongoDatabaseIMongoCollection<T>管理这些对象生命周期的最佳实践是什么?我可以在每个服务器(应用程序域)中使用单例生活方式存储它们,或者我可以根据请求继续创建它们。目前仅针对IMongoCollection<T>每个请求。
我在代码中有 Springfox 注释如下:
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Options for the endpoint", responseHeaders = {@ResponseHeader(name = "Allow", description = "Verbs allowed")})})
Run Code Online (Sandbox Code Playgroud)
但是,标头不会在 Swagger UI 中的响应下方呈现。
如果我通过 Docket 添加全局响应(针对内部服务器错误),则其标头呈现得很好。
这是配置错误还是这里有什么问题?
我目前遇到了一个问题,试图在每个被拦截的类实例中连接一个拦截器实例.
我正在InterceptorRegistrationStrategy中创建和建议并设置回调来解析内核中的拦截器(它有一个注入构造函数).请注意,我只能在回调中实例化拦截器,因为InterceptorRegistrationStrategy没有引用内核本身.
IAdvice advice = this.AdviceFactory.Create(methodInfo);
advice.Callback = ((context) => context.Kernel.Get<MyInterceptor>());
this.AdviceRegistry.Register(advice);
Run Code Online (Sandbox Code Playgroud)
我正在获得每个方法的拦截器实例.
是否有任何方法可以为每个被拦截的类型实例创建一个拦截器实例?
我在考虑命名范围,但截获的类型和拦截器不会互相引用.
ninject ioc-container interceptor ninject-2 ninject-extensions
我正在使用传输安全设置开发WCF服务.当测试客户端代理,并调用服务的方法,我得到如下EndpointNotFoundException:
没有端点监听
https://MyPC/AMTA.WebService/BroadcastInfoService.svc可以接受该消息.这通常是由错误的地址或SOAP操作引起的.有关更多详细信息,请参阅InnerException(如果存在).内部异常:
远程服务器返回错误:(404)Not Found.
我通过visual studio托管我的服务.
web.config 服务:
<system.serviceModel>
<services>
<service name="AMTA.WebService.Broadcasts.BroadcastInfoService">
<endpoint address="/BroadcastInfoService.svc" binding="wsHttpBinding" contract="AMTA.WebService.Interface.Broadcasts.IBroadcastInfoService"/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="TransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
客户配置:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IBroadcastInfoService">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://MyPC/AMTA.WebService/BroadcastInfoService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IBroadcastInfoService"
contract="BroadcastInfoService.IBroadcastInfoService" name="WSHttpBinding_IBroadcastInfoService">
</endpoint>
</client>
</system.serviceModel> …Run Code Online (Sandbox Code Playgroud) c# ×5
.net ×4
java ×3
spring ×3
swagger ×3
interceptor ×2
mongodb ×2
ninject ×2
springfox ×2
ado.net ×1
aop ×1
asp.net ×1
cascade ×1
iis ×1
nhibernate ×1
ninject-2 ×1
nosql ×1
openapi ×1
orm ×1
resharper ×1
silverlight ×1
spring-boot ×1
springdoc ×1
sql ×1
sql-server ×1
unit-testing ×1
wcf ×1
web-services ×1