views:

487

answers:

4

Hello everybody, I am developing a small ASP.NET website for online shopping, when testing it out in Visual Studio, everything works fine, however that is no longer the case when I deploy it to IIS.

The problem seems to be in a DLL file that I reference, this DLL file contains the Classes I need to initialize and send query requests to another server that has all the product information. This DLL was originally a Jar file which I converted to DLL using IKVM.

When I deploy the app to IIS, any page that attempts to instantiate an object defined in that DLL fails with a null reference, for example:

Fulfiller fulfiller = new Fulfiller(); string result = fulfiller.initialize("host", port, "user", "pass");

returns this error:

System.NullReferenceException: Object reference not set to an instance of an object. at Fulfiller.toLog(String ) at Fulfiller.initialize(String str1, Int32 i, String str2, String str3) at Orders.createDataSource()

Now again, this works perfectly on the VS development server but breaks in IIS and I don't know why. Is it some sort of coding problem where the DLL is not loaded properly when running on IIS? or is it a problem with IIS maybe blocking the DLL from executing or sending out requests, I'm very desperate to solve this problem

thanks

A: 

What is fulfiller.Initialize() doing? Can you post that code?

Clearly you have a fulfiller reference, because you can't pass the constructor without error and then have a null-ref.

Ben Scheirman
+3  A: 

Usually, when something that works on the dev sever doesn't work on IIS, the problem is authorizations (the VS server runs under your credentials, but IIS runs as "Network Service" or another system user).

For example, I see your code breaks on fulfiller.toLog().

Could it be that the toLog() function is trying to open a log file and that the user impersonated by IIS is not authorized to read or write it?

Loris
A: 

I second Loris' answer.

The dev server has your permissions. Assuming you are deploying to Windows Server, or any machine running Active Directory, you should be able to right-click on the directory where the log files are stored and select properties. In the dialog box, there will be a tab labeled Security. If the Network Service user (or IUSR_machinename) is not visible, you will have to add them to the list. Select the user and assign them read and write permissions.

Do not give the IIS user full permissions to your entire application directory. It is a huge security vulnerability, hence the default deployment not giving you the permissions that you currently need.

Jason Z
A: 

I have not used IKVM, but I am sure that some IKVM runtime must be installed on the server. Have you checked IKVM on the server?

Hope this helps.