简体   繁体   English

.NET IIS Soap服务器从UNC路径连接Firebird数据库

[英].NET IIS Soap server connect Firebird database from UNC path

I am using Visual studio 2017 with .NET 4.0 and Firebird ADO provider version 4.6. 我正在将Visual Studio 2017与.NET 4.0和Firebird ADO提供程序4.6版一起使用。 I'm having trouble connecting to a database file on a different server then de Web service and the Firebird service. 我无法连接到另一台服务器上的数据库文件,然后再连接到Web服务和Firebird服务。

So for example: 因此,例如:

Firebird host: localhost
Firebird port: 3050

Database file path: \\\\\\\\server1\\C$\\Databases\\test.fdb 数据库文件路径: \\\\\\\\server1\\C$\\Databases\\test.fdb

When I try to setup the connection string I create it like below: 当我尝试设置连接字符串时,如下所示创建它:

connectionstring = "User ID=sysdba;Password=masterkey;Database=localhost/3050:\\server1\C$\Databases\test.fdb;DataSource=localhost;Port=3050;Charset=NONE;";

When I try to connect I get the message "Unavailable database". 当我尝试连接时,出现消息“数据库不可用”。 When I try the same with a Delphi project it does work, so I am sure the host, port and path all work. 当我在Delphi项目中尝试相同的方法时,它确实可以工作,因此我可以确定主机,端口和路径都可以工作。 Is this a bug in de .NET Firebird provider or how can I fix my connection string? 这是de .NET Firebird提供程序中的错误,还是我该如何修复我的连接字符串?

How I build connection string in Delphi: 我如何在Delphi中建立连接字符串:

connectionstring := 'localhost/3050:\\server1\C$\Databases\test.fdb';

By the way I've tried almost every other possibility for setting the database string part. 顺便说一下,我尝试了几乎所有其他可能性来设置数据库字符串部分。

Try to change your statement to the following; 尝试将您的陈述更改为以下内容;

connectionstring = @"User ID=sysdba;Password=masterkey;Database=localhost/3050:\\server1\C$\Databases\test.fdb;DataSource=localhost;Port=3050;Charset=NONE;"

Or if you don't want to use the '@' change it to the following; 或者,如果您不想使用“ @”,请将其更改为以下内容;

connectionstring = "User ID=sysdba;Password=masterkey;Database=localhost/3050:\\\\server1\\C$\\Databases\\test.fdb;DataSource=localhost;Port=3050;Charset=NONE;"

the backslash is interpreted as an escape character so you need to add another backslash to each backslash you don't want escaped or just use the '@' in front of the string and it will do it for you. 反斜杠被解释为转义符,因此您需要为每个不想转义的反斜杠添加另一个反斜杠,或者仅在字符串前面使用“ @”,它将为您完成。

What is your Firebird database version? 您的Firebird数据库是什么版本?

We recently have an upgrade from Firebird 2.5 to Firebird 3.0 and I had to make several changes in my project in order to make it work again. 我们最近从Firebird 2.5升级到Firebird 3.0 ,我必须在项目中进行一些更改才能使其再次正常运行。 Some of them were changing the framework number, replacing the dll in references, changing firebird.conf content etc. 其中一些正在更改框架编号,替换引用中的dll,更改firebird.conf内容等。

For your reference with firebird 3.0 I use this for connection: 供您使用firebird 3.0参考,我将其用于连接:

Imports FirebirdSql.Data.FirebirdClient

Public con As New FbConnection("ServerType=0;User=SYSDBA;Password=bla;Size=4096;Dialect=3;Pooling=FALSE;database=localhost/3050:C:\example.FDB")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM