473,883 Members | 1,680 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebService cant access Postgre database

Sakalicek
51 New Member
Hi all, could you please help me with my big problem?

I have WebService on IIS. This WebService has methods to control database stored on server.
I am using Postgre database and to access to database I have Npgsql.dll library.
This library is stored in GAC (global assembly cache).

The WebService is not able to open the connection to the database even the connection string is allright, everything seems to be OK. But when the function Open() is called, there occurs an errror "Object reference not set to instance of object" or something like this.

Although, if I access the database with some console application, everything goes well.
Just the bloody WebService :(

Thank you very much for any help.
Zdenek Mach.

ICQ# 173965423
skype: Zdenek_Mach
Mar 21 '07
14 4692
Sakalicek
51 New Member
So what?
Do you have some idea?
The exception I got is "The attempted operation was not supported for the type of object referenced".

Zdenek.
Mar 28 '07 #11
Atli
5,058 Recognized Expert Expert
I think it could be your if statment.
It could be that the _conDatabase object cant be null, or that the parser throws the null exception when your checking it.

So I'd try using a try block
Somewhat like this
Expand|Select|Wrap|Line Numbers
  1. private bool Open()
  2. {
  3.   try{
  4.     _conDatabase.Open();
  5.     return true;
  6.   } 
  7.   catch(Exception) {
  8.     try {
  9.       _conDatabase = new NpgsqlConnection(_sConnectionString);
  10.       _conDatabase.Open();
  11.       return true;
  12.     } 
  13.     catch(Exception) {
  14.       // Fatal error
  15.       return false;
  16.     }
  17.   }
  18. }
  19.  
This method will also return false on faliure so your app can handle it rather than having your program crash cause of it.
Mar 28 '07 #12
Sakalicek
51 New Member
I think it would not help me, but I will try it tomorrow morning.

But didnt mention that my colleague tried it on his PC and it worked well.
Connection was opened...

Thereby I think it could be in some permissions or ASPNET account permissions.
I read lot of about it but I am not able to solve this.

Quite desperate, Zdenek.
Mar 28 '07 #13
Sakalicek
51 New Member
Sorry that I am answering too late.
I have found that problem was in my IIS.
It was broken or something, so I have to reinstall OS and than install IIS again.
Now its working well.
Jul 4 '07 #14
navneetkaur
45 New Member
I am doing connectivity to PostgreSql from asp.net 2.0 using odbc but i am not able to connect i got error Data source name not found and no default driver specified.

code is written for connectivity is like...

con = new OdbcConnection( "Driver={Postgr eSQL};Server=Ip Address;Port=54 32;Database=dat abase name;Uid=user id;Pwd=;");

from google i found its alternative npgsql but i dont know why,i am not able to download npgsql.dll...tr ue is i am not able to find that dll from internet...

please help me...how i can download dll for npgsql....pleas e provide me source i need it very much....


i am very thankful to u in advance.
Jan 25 '08 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2662
by: Nicolae Fieraru | last post by:
Hi All, I am working on a web site in asp which will be hosted on a Windows 2003 server. I use the following code to connect to the database: Set objConn = Server.CreateObject("ADODB.Connection") Set objRS1 = Server.CreateObject("ADODB.Recordset") objConn.Provider = "Microsoft.Jet.OLEDB.4.0"
13
7301
by: Zlatko Matić | last post by:
Is it possible to use Access as front-end for POstgreSQL and how ? What about Access Projects (.adp) and PostgreSQL ?
3
2160
by: Trygve Lorentzen | last post by:
Hi, I don't know if this is a stupid question, but I observe that my webservice is created for each call to a webmethod. More precisely an instance of the webservice class is created for each call. This makes the InitializeComponent() method run for each method call and seems to really slow things down. Can I keep the webservice object running after a method call? Trygve
6
1580
by: kenneth fleckenstein nielsen | last post by:
Hi guru's It runs ok on my developmaschine, and on the test server that i've set up. but fails after installing on the customers server. I made a XML webservice that does these steps: a) access a db for updating ( fails on client ) b) saves some associated files (DIMES/SOAP) ( not testet outside development ) c) writes a log file ( fails on client ) I think a and c has to do with setting ISS up correctly on the customers server.
1
1231
by: kamig | last post by:
Hey! guys i have this annoying question i have upgrade my webService project from visual studion.NET 2003 to 2005 but the problem is tht i cant access my webService directly from iis mmc by click the .asmx and selecting browsing in old days of .net 2003.....it gives an error like that user initiated the asp.net process should have access to iis metabase....with Microsoft site i download mataacl.vbs with which i try to add my username say...
3
1074
Sakalicek
by: Sakalicek | last post by:
Hi all, can you please help me? I have Web Service that should do some things on Postgre database. I am using Npgsql.dll to provide functions to make connection to the database. But I am not able to make this connection. I tried to step into the Npgsql source and found out that there is a problem when Socket socket is created. I thought about it and got an idea that it could be in ASP privilegies. I suppose that aspnet_wp.exe process...
1
3599
by: nilart | last post by:
Hi, I have an installer application (Installshield) which installs postgre DB programmatically on windows: I have a requirement where postgre DB is expected work after upgrading OS from windows XP to Vista However once I upgrade to vista somehow ./postgre windows user's password is chnaged or not working If I try to start service Postgre SQL database it gives me "Logon failure" If I manually set password & start a sevice it comes up...
5
4078
by: prajiv | last post by:
Hi, Pls guide me in synchronizing data from PostGre to Cache. i.e if we update in one database the other database must automatically get updated.I dont want to use the Tool ,I need the code for it 2 update from Postgre or from cache.
0
2650
by: freeskier | last post by:
Hello, Sorry for the newb question; I've spent a good amount of time trying to figure this out. I am fairly new to the Postgre world. I am currently in the process of upsizing several MS Access apps to a single PostgreSQL system; I will continue to use Access as the frontend. I have duplicated the table structure in Postgre and have successfully connected Access as a frontend to view data. I am having trouble inserting a record into...
0
9934
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9789
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11137
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10409
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7969
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7120
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5795
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4608
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4214
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.