首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏张善友的专栏

    使用API Key验证WCF Data Service

    API Key作为一个参数在URL中传递, 在Rob Jacobs的WCFWebHttpLibrary.APIKeyAuthorization的方法string GetAPIKey(OperationContext operationContext)的代码如下: 1: public string GetAPIKey(OperationContext operationContext) 2: { 3: // Get the request message 4: var request = operationContext.RequestContext.RequestMessage; OnStartProcessingRequest(ProcessRequestArgs args) 2: { 3: var queryParams = HttpUtility.ParseQueryString(args.OperationContext.AbsoluteRequestUri.Query string apiKey = queryParams[APIKEY]; 5: if (apiKey == null) 6: { 7: apiKey = args.OperationContext.RequestHeaders

    1.1K80发布于 2018-01-19
  • 来自专栏大内老A

    WCF技术剖析之十七:消息(Message)详解(下篇)

    我们可以借助System.ServiceModel.OperationContext实现这样的功能。 注: OperationContext代表服务操作执行的上下文。通过OperationContext可以得到出栈和入栈消息的SOAP报头列表、消息属性或者HTTP报头。 对于Duplex服务,在服务端可以通过OperationContext得到回调对象。此外通过OperationContext还可以得到基于当前执行的安全方面的属性一起的其他相关信息。 1: public sealed class OperationContext : IExtensibleObject<OperationContext> 2: { 3: // 对于客户端来说,当前的OperationContext生命周期和OperationContextScope一样,一旦成功创建OperationContextScope,就会创建当前的OperationContext

    1.5K60发布于 2018-01-16
  • 来自专栏腾讯技术工程官方号的专栏

    巧用 maxTimeMS 服务端超时,避免承载亿级用户的腾讯云数据库MongoDB服务雪崩

    MongoDB原生服务端超时原理 当一个用户请求到达 mongos 或者 mongod 时,会生成一个对应的 OperationContext 对象,来记录这个请求从开始到结束期间的完整上下文信息。 标记为了终止状态; 3.用户通过 maxTimeMS 参数给 OperationContext 配置了超时 Deadline,然后检测到 hasDeadlineExpired() 为 true; 一个请求在执行过程中会多次调用 备注2:终止OperationContext 和 kill 进程/线程行为不同。OperationContext 自己检测和主动退出的机制使得 killOp 和 maxTimeMS 不会绝对精确。 下图展示一个写请求在mongos 上的执行路径,比较关键的点有: 在 runCommand 函数中,会从命令中解析 maxTimeMS(客户指定的),并设置 OperationContext 的 deadline 只能跟踪 1 个请求在 1 个进程中的执行信息,也就是说 mongos 和 mongod 各自有自己独立的 OperationContext

    1.4K51发布于 2021-11-01
  • 来自专栏大内老A

    [WCF权限控制]利用WCF自定义授权模式提供当前Principal[原理篇]

    class ServiceAuthorizationManager 2: { 3: //其他成员 4: public virtual bool CheckAccess(OperationContext operationContext); 5: public virtual bool CheckAccess(OperationContext operationContext, ref Message message); 6: protected virtual bool CheckAccessCore(OperationContext operationContext) operationContext) 4: { 5: //其他操作 6: AuthorizationContext authorizationContext = operationContext.ServiceSecurityContext.AuthorizationContext; 7: authorizationContext.Properties

    66190发布于 2018-02-07
  • 来自专栏云计算与数据库

    MongoDB分片迁移原理与源码(3)

    Status MigrationSourceManager::awaitToCatchUp(OperationContext* opCtx) {    // Block until the cloner Status MigrationSourceManager::enterCriticalSection(OperationContext* opCtx) {    //表明当前分片上的该集合进入X锁阶段 Status MigrationSourceManager::commitChunkOnRecipient(OperationContext* opCtx) {    //发送"_recvChunkCommit void MigrationDestinationManager::_migrateDriver(OperationContext* opCtx) {   {        //to shard开始之后的第一步 auto assertNotAborted = [&](OperationContext* opCtx) {            opCtx->checkForInterrupt();            

    2K11发布于 2020-04-02
  • 来自专栏【腾讯云开发者】

    鹅厂程序员爆肝整理,万字长文讲透MongoDB中的锁

    而锁的定义在 OperationContext 中是这样定义的: // operation_context.h class OperationContext : public Interruptible , public Decorable<OperationContext> { OperationContext(const OperationContext&) = delete; OperationContext & operator=(const OperationContext&) = delete; public: ...... // Interface for locking. 同时通过 OperationContext->lockState()->lock() 接口获取对应的 Database 资源锁。 这里继续看 _lockComplete() 的实现: // lock_state.cpp void LockerImpl::_lockComplete(OperationContext* opCtx,

    1.1K21编辑于 2024-02-22
  • 来自专栏腾讯云数据库(TencentDB)

    万字长文讲透MongoDB中的锁

    而锁的定义在 OperationContext 中是这样定义的: // operation_context.h class OperationContext : public Interruptible , public Decorable<OperationContext> { OperationContext(const OperationContext&) = delete; OperationContext & operator=(const OperationContext&) = delete; public: ...... // Interface for locking. 同时通过 OperationContext->lockState()->lock() 接口获取对应的 Database 资源锁。 这里继续看 _lockComplete() 的实现: // lock_state.cpp void LockerImpl::_lockComplete(OperationContext* opCtx,

    2.7K10编辑于 2024-02-27
  • 来自专栏MongoDB中文社区

    MongoDB事务模型分析

    单行事务的实现 OperationContext与RecoveryUnit 客户端的每个请求(insert/update/delete/find/getmore),会生成一个唯一的OperationContext 记录执行的上下文,OperationContext从请求解析时创建,到请求执行完成时释放。 OperationContext创建时,会初始化RecoveryUnit。 ? RecoveryUnit封装了wiredTiger层的事务。 它是对OperationContext和RecoveryUnit的封装。 ? ? Mongodb通过实现事务框架(RecoveryUnit,OperationContext, WriteUnitOfWork)将细节封装。

    2.1K20发布于 2018-08-14
  • 来自专栏码上遇见你

    鹅厂程序员爆肝整理,万字长文讲透MongoDB中的锁

    而锁的定义在 OperationContext 中是这样定义的: // operation_context.h class OperationContext : public Interruptible , public Decorable<OperationContext> { OperationContext(const OperationContext&) = delete; OperationContext & operator=(const OperationContext&) = delete; public: ...... // Interface for locking. 同时通过 OperationContext->lockState()->lock() 接口获取对应的 Database 资源锁。 这里继续看 _lockComplete() 的实现: // lock_state.cpp void LockerImpl::_lockComplete(OperationContext* opCtx,

    34910编辑于 2024-03-02
  • 来自专栏hbbliyong

    WCF 获取客户端IP

    { Name = "sdf", Age = 12 }; } public string ClientIpAndPort() { OperationContext context = OperationContext.Current; MessageProperties properties = context.IncomingMessageProperties

    3.1K40发布于 2018-03-05
  • 来自专栏腾讯数据库技术

    巧用 maxTimeMS 服务端超时,避免承载亿级用户的腾讯云数据库MongoDB服务雪崩

    MongoDB原生服务端超时原理 当一个用户请求到达 mongos 或者 mongod 时,会生成一个对应的 OperationContext 对象,来记录这个请求从开始到结束期间的完整上下文信息。 标记为了终止状态; 3.用户通过 maxTimeMS 参数给 OperationContext 配置了超时 Deadline,然后检测到 hasDeadlineExpired() 为 true; 一个请求在执行过程中会多次调用 备注2:终止OperationContext 和 kill 进程/线程行为不同。OperationContext 自己检测和主动退出的机制使得 killOp 和 maxTimeMS 不会绝对精确。 下图展示一个写请求在mongos 上的执行路径,比较关键的点有: 在 runCommand 函数中,会从命令中解析 maxTimeMS(客户指定的),并设置 OperationContext 的 deadline 只能跟踪 1 个请求在 1 个进程中的执行信息,也就是说 mongos 和 mongod 各自有自己独立的 OperationContext

    95820发布于 2021-10-14
  • 来自专栏腾讯大讲堂的专栏

    如何避免承载亿级用户的服务端雪崩

    MongoDB原生服务端超时原理 当一个用户请求到达 mongos 或者 mongod 时,会生成一个对应的 OperationContext 对象,来记录这个请求从开始到结束期间的完整上下文信息。 标记为了终止状态; 3.用户通过 maxTimeMS 参数给 OperationContext 配置了超时 Deadline,然后检测到 hasDeadlineExpired() 为 true; 一个请求在执行过程中会多次调用 备注2:终止OperationContext 和 kill 进程/线程行为不同。OperationContext 自己检测和主动退出的机制使得 killOp 和 maxTimeMS 不会绝对精确。 下图展示一个写请求在mongos 上的执行路径,比较关键的点有: 在 runCommand 函数中,会从命令中解析 maxTimeMS(客户指定的),并设置 OperationContext 的 deadline 只能跟踪 1 个请求在 1 个进程中的执行信息,也就是说 mongos 和 mongod 各自有自己独立的 OperationContext

    97430发布于 2021-10-25
  • 来自专栏芋道源码1024

    Apollo 源码解析 —— Portal 发布配置

    name = "Operation") private int operation; /** * 操作 Context */ @Column(name = "OperationContext ", nullable = false) private String operationContext; } appId + clusterName + namespaceName = Maps.newHashMap(); 39: operationContext.put(ReleaseOperationContext.IS_EMERGENCY_PUBLISH, isEmergencyPublish previousReleaseId); // 上一个 Release 编号 20: releaseHistory.setOperation(operation); 21: if (operationContext /default empty object 23: } else { 24: releaseHistory.setOperationContext(gson.toJson(operationContext

    1.5K20发布于 2020-06-01
  • 来自专栏JAVA后端开发

    flowable实现多实例节点的自由跳转(二)

    processInstanceId(task.getProcessInstanceId()) .moveActivityIdTo(task.getTaskDefinitionKey(), operationContext.getTargetNodeId ()) .processVariables(operationContext.getFormData()).changeState(); 确实这样简单及方便多了!

    3.3K40发布于 2019-05-05
  • 来自专栏张善友的专栏

    Mono 3.0.2 基于双工通信的WCF应用 Demo

    在WCF中,回调对象通过当前OperationContext的GetCallback<T>方法获得(T代表回调契约的类型)。 ? OperationContext在WCF中是一个非常重要、也是一个十分有用的对象,它代表服务操作执行的上下文。 我们可以通过静态属性Current(OperationContext.Current)得到当前的OperationContext。 借助OperationContext,我们可以在服务端或者客户端获取或设置一些上下文,比如在客户端可以通过它为出栈消息(outgoing message)添加SOAP报头,以及HTTP报头(比如Cookie

    1K60发布于 2018-01-29
  • 来自专栏大内老A

    我的WCF之旅(13):创建基于MSMQ的Responsive Service

    Soap Header的插入和获取: 我们可以通过下面的方式获得当前Operation Context的Incoming Message Headers和Outgoing Message Headers OperationContext.Current.IncomingMessageHeaders OperationContext.Current.OutgoingMessageHeaders 如果我们要把一个OrderResponseContext 对象插入到当前Operation Context (); MessageHeader<OrderResponseContext> header = new MessageHeader<OrderResponseContext>( context); OperationContext.Current.OutgoingMessageHeaders.Add 相应的,我们可以通过下面的代码从Outgoing Message Headers OrderResponseContext的数据获取的内容: OrderResponseContext context = OperationContext.Current.IncomingMessageHeaders.GetHeader public static OrderResponseContext Current { get { if (OperationContext.Current

    97470发布于 2018-02-07
  • 来自专栏技术小讲堂

    WCF中操作的分界于调用顺序和会话的释放操作分界实例停止

    方法很简单,在OperationContext中存在InstanceContext,而这个属性包含一个ReleaseServiceInstance方法,在这个方法调用之后服务将会被释放: [OperationBehavior (ReleaseInstanceMode=ReleaseInstanceMode.AfterCall)] public void Close() {     lockBox();     OperationContext.Current.InstanceContext.ReleaseServiceInstance

    1K60发布于 2018-03-07
  • 来自专栏芋道源码1024

    Apollo 源码解析 —— Portal 灰度全量发布

    operateNamespaceItems = getNamespaceItems(namespace); 18: 19: // 创建 Map ,用于 ReleaseHistory 对象的 `operationContext 20: Map<String, Object> operationContext = Maps.newHashMap(); 21: operationContext.put(ReleaseOperationContext.SOURCE_BRANCH , branchName); 22: operationContext.put(ReleaseOperationContext.BASE_RELEASE_ID, branchReleaseId ); 23: operationContext.put(ReleaseOperationContext.IS_EMERGENCY_PUBLISH, isEmergencyPublish); 第 11 至 23 行:创建 Map ,并设置需要的 KV ,用于 ReleaseHistory 对象的 operationContext 属性。

    1.1K10发布于 2020-06-01
  • 来自专栏大内老A

    回调与并发: 通过实例剖析WCF基于ConcurrencyMode.Reentrant模式下的并发控制机制

    //Callback 12: EventMonitor.Send(EventType.StartCallback); 13: int clientId = OperationContext.Current.IncomingMessageHeaders.GetHeader ); 14: MessageHeader<int> messageHeader = new MessageHeader<int>(clientId); 15: OperationContext.Current.OutgoingMessageHeaders.Add messageHeader.GetUntypedHeader(EventMonitor.CientIdHeaderLocalName, EventMonitor.CientIdHeaderNamespace)); 16: OperationContext.Current.GetCallbackChannel MessageHeader<int> messageHeader = new MessageHeader<int>(clientId); 34: OperationContext.Current.OutgoingMessageHeaders.Add

    74680发布于 2018-01-16
  • 来自专栏大内老A

    [WCF权限控制]WCF自定义授权体系详解[实例篇]

    SimpleServiceAuthorizationManager : ServiceAuthorizationManager 7: { 8: protected override bool CheckAccessCore(OperationContext operationContext) 9: { 10: string action = operationContext.RequestContext.RequestMessage.Headers.Action ; 11: foreach (ClaimSet claimSet in operationContext.ServiceSecurityContext.AuthorizationContext.ClaimSets GenericIdentity identity = new GenericIdentity(""); 20: operationContext.ServiceSecurityContext.AuthorizationContext.Properties

    1.1K80发布于 2018-01-16
领券