【发布时间】:2010-09-21 15:06:41
【问题描述】:
我有一个 WCF 服务,托管在 IIS 7.0 中,需要运行数据库查询。为了获得执行此操作的正确权限,我在服务中模拟如下:
代码
[OperationBehavior(Impersonation = ImpersonationOption.Allowed)]
public void MyOperation(int arg)
配置
<behavior name="ReceivingServiceBehavior">
<!-- Other behaviors -->
<serviceAuthorization impersonateCallerForAllOperations="true" />
</behavior>
当我尝试连接并运行我的查询时,我得到以下信息:
异常 - System.IO.FileLoadException:无法加载文件或 程序集'System.Transactions,版本=2.0.0.0,文化=中性, PublicKeyToken=b77a5c561934e089' 或其依赖项之一。要么 未提供所需的模拟级别,或提供的 模拟级别无效。 (来自 HRESULT 的异常:0x80070542) 文件名:'System.Transactions,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089' ---> System.Runtime.InteropServices.COMException (0x80070542):未提供所需的模拟级别,或提供的模拟级别无效。 (来自 HRESULT 的异常:0x80070542) 在 System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser 用户) 在 System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe() 在 System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode() 在 System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(表达式查询) 在 System.Data.Linq.DataQuery`1.System.Collections.Generic.IEnumerable.GetEnumerator() 在 System.Linq.Buffer`1..ctor(IEnumerable`1 源) 在 System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 源) 在 Fourth.GHS.MessageRelay.RegistrationDBStorage.FindRegistration(SystemKey 键)【问题讨论】:
标签: .net sql-server wcf security transactions