English 中文(简体)
2. 挥发性Nhibernate “invalid orcompparposition”在“WCF测试客户”中运行
原标题:Fluent Nhibernate "invalid or incomplete configuration" when running in "WCF Test Client"

我拥有一个WCF网络服务网站、网络服务图书馆以及一个和我拥有一个使用流星号的项目。

当我管理WCF项目并管理一个网络服务时,只要不提供进入该数据库的服务,它就进行罚款。

如果我援引一个与世行连接的网络服务,我总是在这里出现错误:

      _sessionFactory = Fluently.Configure()
            .Database(MsSqlConfiguration.MsSql2008.ConnectionString(@"Server=MYSERVER;database=MYDATABASE;Trusted_Connection=true;")

                .ShowSql()
            )
            .Mappings(m => m.FluentMappings
                    .AddFromAssemblyOf<WhygoDomain.Location>())
            .ExposeConfiguration(cfg => new SchemaExport(cfg)
            /* .Create(true, true)*/) 
            .BuildSessionFactory();

Which says: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.

Inner Exception says: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.)

I do not get this message if I do the following: 1) Right click on the webservice.svc and copy the "view in browser" link. 2) (in the WCF test client) right click on "my service projects"-> "add service" and paste in the URL from 1) above

我一直在这样做,但进展缓慢,这意味着我可以 t笑,这实在是可以接受的。

What s happening here? It seems like a permission problem connecting to the database, but I m new to most of this so it may be something else.

我已尝试允许任何用户查阅数据库,但没有任何改动。 谁使用WCF测试客户,谁知道?

这个问题的结果是,我可以 t击我的网络服务,这对我来说是一个问题。 我会想我会试图随心处理或做些事情,但这种 would子是理想之举,因为我有丰富的网络服务工作。

问题回答

check that your service in running in IIS with full trust. OLEDB or ODBC works only in full trust under IIS even though, if you can modify the file web_mediumtrust.config in C:WindowsMicrosoft.NETFrameworkv4.0.30319Config, you can add in the SecurityClasses section:

<SecurityClass Name="OleDbPermission" Description="System.Data.OleDb.OleDbPermission, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<SecurityClass Name="OdbcPermission" Description="System.Data.OleDb.OdbcPermission, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

Is the connection string set to windows authentication? If so set it to SQL Server Authentication and see if it still works testing it locally. Also check that the database is setup to use both Windows Authentication and SQL Server Authentication.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签