Jump to content
  • Advertisement
Sign in to follow this  

[web] ASP.Net Unmanaged DLL problem

This topic is 3798 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wrote a win32 DLL to do some custom data storage for a project. I then used DllImport to access the functions in this DLL from my asp.net pages. This works perfectly on my test setup of Windows XP Pro SP2 using Visual Web Developer Express 2008's builtin development server. It also works correctly using IIS 5 with .net framework 3.5 installed. However, when I move the code to a Windows 2003 Server Enterprise Server, which runs IIS 6 (also with .net framework 3.5), the dll function call throws an exception: System.DllNotFoundException: Unable to load DLL 'DataAPI.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) at DataAPIDLL.CloseNewStorage(Int32 iStorageID) at TestDLL.Page_Load(Object sender, EventArgs e) in e:\webroot\TestDLL.aspx.cs:line 27 DataAPI.dll is currently in the bin directory of my site. Here is a sample code-behind file of a page that I am using to do this test:
using System;
using System.Runtime.InteropServices;

public class DataAPIDLL {

	public static extern void CloseNewStorage(int iStorageID);

public partial class TestDLL : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
		try {
		} catch (Exception ex) {
			lblResult.Text = ex.ToString();
It seems to make no difference if I specify an entrypoint or charset in the dllimport statement. It works on the development machine's dev-server and IIS but not on the win2k3 machine. There were also some short periods of time (minutes) where it did not work on the development server for no apparent reason. That problem seemed to fix itself. Any suggestions. I've been screwing around with this for almost 2 full days and have gotten nowhere. The passive internet usually has answers to these obscure technical problems, but not this time. I have tried a few other things, but don't want to list them since they might dissuade suggestions. Thanks. If you think I could learn something useful from it, I could install and try the visual webdev development server on the win2k3server system and see how that behaves.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!