none
Unmanaged function call fails outside of debug mode RRS feed

  • Question

  • Hello -

    I have a web service created in vs 2010 using vb. On windows 7, IIS 7 a call to an external dll throws an unhandled win32 exeption [6644]. This same function will work if I run the project in debug mode on my local machine. The same function also works fine on IIS 6, win 2003.

    I've downloaded DebugDiag to try to see what was causing the problem but have not seen any useful information from the logs. I've added permissions to the NETWORKSERVICE user for full access to the machine and changed the app pool to use that user. I've changed the app pool to use 32 bit dlls. Verified the project was set to compile for 32 bit cpus...

    When I attach to the process and step through the code it will fail when it tries to retrieve a formatted string from the dll.

    Any ideas or guidance would be appreciated. Thanks in advance.

        Public Shared Function GenerateLicenseNow(ByVal inLicense As String) As String
            Dim pDll As IntPtr = NativeMethods.LoadLibrary("C:\inetpub\wwwroot\externaldlls\rsilicgen_11_6.dll")

            Dim pAddressOfFunctionToCall As IntPtr = NativeMethods.GetProcAddress(pDll, "GenerateLicense")
            Dim genLicense As GenerateLicense = DirectCast(Marshal.GetDelegateForFunctionPointer(pAddressOfFunctionToCall, GetType(GenerateLicense)), GenerateLicense)

            >>FAILS HERE >>>> Dim theResult As String = genLicense(inLicense)

            'NativeMethods.FreeLibrary(pDll)
            Return theResult

        End Function


    Monday, July 16, 2012 10:42 PM

Answers