没有 MTS 对象上下文 (异常来自 HRESULT:0x8004E004)
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Runtime.InteropServices.COMException: 没有 MTS 对象上下文 (异常来自 HRESULT:0x8004E004)
源错误:
行 206: finally
行 207: {
行 208: ServiceDomain.Leave();
行 209: }
行 210:
堆栈跟踪:
[COMException (0x8004e004): 没有 MTS 对象上下文 (异常来自 HRESULT:0x8004E004)]
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) +0
System.EnterpriseServices.ServiceDomain.Leave() +142
system_blog_templete_admin_temp_upload.Button1_Click(Object sender, EventArgs e) in e:\wwwroot\noble\Admin\admin_templete\temp_upload.aspx.cs:208
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
源码太多 :
主要是使用了下面的代码后就出现了上面的错误
using System.EnterpriseServices;//引用命名空间
try{
ServiceConfig config = new ServiceConfig();
config.Transaction = TransactionOption.Required;
ServiceDomain.Enter(config);//运用事务
//方法的实现
////////////////////
ContextUtil.SetComplete();//事务提交,所有操作全部执行
}catch{
ContextUtil.SetAbort();//事务会滚,所有操作失效
}finally{
ServiceDomain.Leave();