Skip to content

.net core webApi 起线程时使用AspectCore,抛出ObjectDisposedException #275

Open
@KhalidDu

Description

@KhalidDu

在.net core 3.1 中,我有一个启用事务的特性, 使用Autofac管理容器, 当我有一个Api场景, 需要及时的返回结果, 故, 我在Api被调用时, 启用了一个线程, 此时, 启用事务的特性被标记在接口上, 并在线程中被调用, 当我调用接口时(测试可以使用threade.sleep(10000)),当接口返回成功是, 继续执行线程中的内容时, 会抛出objectDisposedException, 我检查了好久的代码, 才找到问题, 当我去掉特性时, 一切又恢复了正常

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions