小编Rob*_*lor的帖子

无法成功启动或连接到子MSBuild.exe进程

在VS2012中,经常构建I时会出现以下错误:

Error   5   The build stopped unexpectedly because of an internal failure.
Microsoft.Build.Exceptions.BuildAbortedException: Build was canceled. Failed to successfully launch or connect to a child MSBuild.exe process. Verify that the MSBuild.exe "C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" launches successfully, and that it is loading the same microsoft.build.dll that the launching process loaded. If the location seems incorrect, try specifying the correct location in the BuildParameters object, or with the MSBUILD_EXE_PATH environment variable.
   at Microsoft.Build.BackEnd.NodeProviderOutOfProc.CreateNode(Int32 nodeId, INodePacketFactory factory, NodeConfiguration configuration)
   at Microsoft.Build.BackEnd.NodeManager.AttemptCreateNode(INodeProvider nodeProvider, NodeConfiguration nodeConfiguration)
   at …
Run Code Online (Sandbox Code Playgroud)

msbuild visual-studio-2010 visual-studio-2012

8
推荐指数
1
解决办法
4549
查看次数

使用NHibernate的Windows服务中的多个SessionFactories

我有一个连接到2个DB的Webapp(一个核心,另一个是日志记录DB).

我现在必须创建一个Windows服务,它将使用相同的业务逻辑/数据访问DLL.但是,当我尝试在服务应用程序中引用2个会话工厂并调用factory.GetCurrentSession()方法时,我收到错误消息"没有会话绑定到当前上下文".

有没有人建议如何做到这一点?

public class StaticSessionManager
{
    public static readonly ISessionFactory SessionFactory;
    public static readonly ISessionFactory LoggingSessionFactory;

    static StaticSessionManager()
    {
         string fileName = System.Configuration.ConfigurationSettings.AppSettings["DefaultNHihbernateConfigFile"];
         string executingPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
         fileName = executingPath + "\\" + fileName;
         SessionFactory = cfg.Configure(fileName).BuildSessionFactory();

         cfg = new Configuration();
         fileName = System.Configuration.ConfigurationSettings.AppSettings["LoggingNHihbernateConfigFile"];
         fileName = executingPath + "\\" + fileName;
         LoggingSessionFactory = cfg.Configure(fileName).BuildSessionFactory();
    }
}  
Run Code Online (Sandbox Code Playgroud)

配置文件具有以下设置:

<property name="current_session_context_class">call</property>
Run Code Online (Sandbox Code Playgroud)

该服务设立工厂:

private ISession _session = null;
private ISession _loggingSession = null;
private ISessionFactory _sessionFactory = StaticSessionManager.SessionFactory;
private ISessionFactory _loggingSessionFactory = …
Run Code Online (Sandbox Code Playgroud)

.net nhibernate service session

6
推荐指数
1
解决办法
2654
查看次数