ASP.NET Application Aborts When Deploying to IIS
I am developing a small ASP.NET web site for online shopping, testing it in Visual Studio, everything works fine, however this is no longer the case when I deploy it to IIS.
The problem seems to be in the DLL file I reference, this DLL file contains classes that I need to initialize and send request requests to another server that has all the product information. This DLL was originally a Jar file that I converted to a DLL using IKVM.
When I deploy my application to IIS, any page that tries to instantiate an object defined in this DLL fails with a null reference, e.g .:
Fulfiller fulfiller = new Fulfiller();
string result = fulfiller.initialize("host", port, "user", "pass");
returns this error:
System.NullReferenceException
: object reference not set to object instance. atFulfiller.toLog(String )
atFulfiller.initialize(String str1, Int32 i, String str2, String str3)
atOrders.createDataSource()
Now again this works fine on VS development server, but breaks in IIS and I don't know why. Is it some kind of coding issue where the DLL doesn't load properly when running in IIS? or is it an IIS issue, maybe a DLL blocking from executing or sending requests, I am very desperate to try to fix this issue.
thank
Usually, when something running on dev sever doesn't work on IIS, the problem is with authorization (VS server runs under your credentials, but IIS runs as "Network Service" or some other system user).
For example, I can see that your code is breaking into execute.toLog ().
Could it be that the toLog () function is trying to open the log file and that the user issued by IIS is not allowed to read or write?
source to share
The second Loris's answer.
The dev server has its own permissions. Assuming you are deploying to Windows Server or any machine with Active Directory, you should right-click on the directory where the log files are stored and select properties. The Security tab appears in the dialog box. If the network service user (or IUSR_machinename) does not appear, you will have to add them to the list. Select a user and assign read and write permissions.
Do not give IIS users full permissions for the entire application directory. This is a huge security vulnerability, so the default deployment does not give you the required permissions.
source to share