1

因此,我试图运行一个ASP.NET MVC 5,NHibernate和FluentNHibernate以Visual Studio 2015 for Mac和XSP Webserver为目标,SQL Server 2012,以及它会失败,下面的例外。我使用的是.NET Framework 4.5,包更新到最后一个版本。使用Visual Studio 2015 for Mac运行流利NHibernate项目时出现错误500

System.ArgumentNullException 
Value cannot be null. 
Parameter name: type 

Description: HTTP 500.Error processing request. 
Details: Non-web exception. Exception origin (name of application or object): System.Core. 
Exception stack trace: 
    at System.Dynamic.Utils.ContractUtils.RequiresNotNull (System.Object value, System.String paramName) [0x00003] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/external/corefx/src/Common/src/System/Dynamic/Utils/ContractUtils.cs:67 
    at System.Linq.Expressions.Expression.Convert (System.Linq.Expressions.Expression expression, System.Type type, System.Reflection.MethodInfo method) [0x0000b] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/UnaryExpression.cs:780 
    at System.Linq.Expressions.Expression.Convert (System.Linq.Expressions.Expression expression, System.Type type) [0x00000] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/UnaryExpression.cs:763 
    at NHibernate.Util.DelegateHelper.BuildPropertySetter[T] (System.Type type, System.String propertyName) [0x00015] in <1c5d1dfd6b734554b068885679d8b49d>:0 
    at NHibernate.AdoNet.SqlClientSqlCommandSet..cctor() [0x00019] in <1c5d1dfd6b734554b068885679d8b49d>:0 

也许这是一个NHibernate或FluentNHibernate的bug?

+0

没有你找出那里的任何东西?我想我有同样的问题 – less

+0

不幸的是,没有......可能最好的解决方法应该是将这些库的源代码添加到项目中并自己调试,但是现在我不能这样做,因为我也是这样在我的日程安排后... – Hetote

+0

感谢您的回答。我在项目中添加了NHibenrate并得到了Socket异常。正如我只想尝试NHibernate我切换到Win 10机器,它的工作。 – less

回答

1

我想我找到了一个解决方案。由于存在错误之类的东西,我们需要用零批量配置的数据库,以避免此异常:

 return Fluently.Configure() 

      .Database(MsSqlConfiguration.MsSql2012.ConnectionString(
      x => x.FromConnectionStringWithKey("ConexaoBanco")).ShowSql()) 

      .Mappings(m => 
       m.FluentMappings.AddFromAssemblyOf<HomeController>()) 

      .ExposeConfiguration(cfg => cfg.SetProperty("adonet.batch_size", "0")) 

      .BuildSessionFactory(); 

我应该给予适当的信贷到STA-傻瓜的解决方案:http://sta-blockhead.blogspot.com.br/2009/06/systemdatasqlclientsqlcommandset.html

相关问题