Webservice oledbconnection does not work in IIS
Could you help me?
I made a small webservice in c#, there is an oledb connection. The webservice is operate from developer tools perfectly, but in the IIS only appear, and the connection does not work.
I have windows 7, 64 bit, Place of Database:C:/map/map.mdb, my connection string is in the webconfig, :
In the virtual directory I set same directory as visual studio, same file operate differently...
Thank you George
6 answers
Update your question with some more info please!
The connection string. The error message.
Is both server and devsystem 64-bit OS?
Thank you for your answer,
Connection string:
error message from iis:
System.NullReferenceException: Az objektumhivatkozás nincs beállítva semmilyen objektumpéldányra.
a következő helyen: Biz.Bal.getAsztalszam(String asz) hely: d:\Gyurma\C#\AdatbElereseWebservice\App_Code\Biz\Bal.cs, sor: 23
a következő helyen: Service.getAsztalszam(String asz) hely: d:\Gyurma\C#\AdatbElereseWebservice\App_Code\Service.cs, sor: 23
(an object reference is not set...)(not find the database.)
message from developer tools:
(operate perfectly)
server and devsystem is on the same machine....
Nullreference exception doesnt say much.. Please paste the code where error happens!
Bal.cs 23 line:
public static Model.Rendeles getAsztalszam(string asz)
{
Model.Rendeles rend = Data.Dal.getAsztalszam(asz);
rend.asztalszam = rend.asztalszam; (23. line)
return rend;
}
service.cs 23 line:
[WebMethod]
public Model.Rendeles getAsztalszam(string asz)
{
return Biz.Bal.getAsztalszam(asz); (23. line)
}
The
Data.Dal.getAsztalszam(asz);
method have obviously returned null. That's why you get the error.
I can't follow the logic from this little piece of code (and I don't know your language) so can not elaborate more on what's happening but since the method is on the DAL component you are probably loading something based on a key (string asz) and nothing was found... Are you sure using the same data in IIS that in DEVENV. (The same mdb/Accdb file).
Or maybe some error handling suppressing and returning null inside Data.Dal.getAsztalszam(asz) method.
Paste source for Data.Dal.getAsztalszam(asz) please, if you're not finding a solution out of the above.
The solution was: %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.enable32BitAppOnWin64:true