小编Myk*_*hko的帖子

使用TransactionScope的异常"操作对事务状态无效"

我们在服务器#1上有一个Web服务,在服务器#2上有一个数据库.Web服务使用事务范围来生成分布式事务.一切都是正确的.

我们在服务器#3上有另一个数据库.我们在服务器上遇到了一些问题,我们重新安装了操作系统和软件.我们配置了MSDTC并尝试使用来自服务器#1的Web服务与该服务器上的数据库进行通信.现在,在事务范围内的第一个select语句之后,我们得到:The operation is not valid for the state of the transaction.如果使用事务范围,则此异常属于每个Web服务请求.服务器#2和服务器#3几乎相似.差异只能在设置中.在所有服务器上安装.NET Framework 3.5 SP1和SQL Server SP3.

完整的堆栈跟踪:

System.Transactions.TransactionState.EnlistPromotableSinglePhase(InternalTransaction TX,IPromotableSinglePhaseNotification promotableSinglePhaseNotification,事务AtomicTransaction的)вSystem.Transactions.Transaction.EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification promotableSinglePhaseNotification)вSystem.Data.SqlClient.SqlInternalConnection.EnlistNonNull(事务TвSystem.Data.SqlClient.SqlInternalConnection .Enlist(事务t,System.Data.SqlClient.SqlInternalConnectionTds.Activate(事务事务),System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(事务事务),System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) - 系统. Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) - System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection,DbConnectionFactory connectionFactory) - System.Data.SqlClient.SqlConnection.Open()NHibernate.Connection.DriverConnectionProvider.GetConnection()вNHibernate.Impl.SessionFactoryImpl.OpenConnection()

我搜索了这条消息,但没有找到任何合适的解决方案.那么我应该检查哪些设置以及我应该做些什么来解决它?

c# sql-server nhibernate msdtc

18
推荐指数
2
解决办法
4万
查看次数

PDF到XPS通过Microsoft XPS Document Writer进行转换

使用Microsoft XPS Document Writer打印pdf文档:

string filename = "C:\\1.pdf";

Process process = new Process();
process.StartInfo.Verb = "PrintTo";

process.StartInfo.FileName = @"C:\Program Files\Adobe\Reader 9.0\Reader\acrord32.exe";

process.StartInfo.Arguments = 
    "/t \"C:\\1.pdf\" \"Microsoft XPS Document Writer\" \"xps\"  XPSPort:";

process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.CreateNoWindow = true;

process.StartInfo.UseShellExecute = false;

process.Start();
process.StandardOutput.ReadToEnd();

process.WaitForExit();
Run Code Online (Sandbox Code Playgroud)

唯一的问题是保存对话框,它请求文件名(*.xps)保存结果的位置.Everbody建议DOCINFO解决这个问题,但我没有找到任何使用的例子.我需要以编程方式通过Microsoft XPS Document Writer以默认输出文件名打印PDF文件.在这种情况下我应该如何使用DOCINFO?

你能帮助我吗?

c# xps

9
推荐指数
1
解决办法
9752
查看次数

通过Microsoft Graph API访问Microsoft Teams频道消息时出现错误:Proxy_InternalServerError

通过委派权限获取团队频道消息时(用户是团队的成员):

https://graph.microsoft.com/beta/teams/ {team_id} / channels / {channel_id} / messages /

出现错误:

{
  "error": {
  "code": "Proxy_InternalServerError",
  "message": "Failure in forwarding request.",
  "innerError": {
    "request-id": "511b812c-df43-402b-b9dd-34ca1c1bd397",
    "date": "2019-02-01T14:22:50"
  }
}
Run Code Online (Sandbox Code Playgroud)

经过Graph Explorer和代码测试。

它对任何人有用吗?

microsoft-graph microsoft-teams

5
推荐指数
1
解决办法
178
查看次数