Metode Dll tidak dipanggil di windows server 2008 (Dll methods are not invoked on windows server 2008)


問題描述

Metode Dll tidak dipanggil di windows server 2008 (Dll methods are not invoked on windows server 2008)

I'm trying to invoke on dll method from an ASP.net web. It's working on a W2003 server but the same dll and the same web is crashing on w2008 server R2 with IIS 7.5.I'm doing like this to import the dll:

<DllImport("Cripto.dll")> _
        Public Shared Function DesCipher(ByVal uiMode As Integer, ByVal uiLength As        Integer, ByVal szSourceData As String) As String

End Function

I have tried a 64 bits dll compile but the problem remains.

I'm going mad...

Please Help!

‑‑‑‑‑

參考解法

方法 1:

Finally I have found the clue. It is a memory location problem. The main function was returning an array like this:   char retorno[10000];

The function was declared in the dll code as "char*"

By changing these lines:

     ULONG  ulSize = strlen((char*)retorno) + sizeof(char);
     char*  pszReturn = NULL;
     pszReturn = (char*)::GlobalAlloc(GMEM_FIXED, ulSize);
     strcpy(pszReturn, (char*)retorno);
     return pszReturn;

instead of         return ((char *)retorno)

Now it's working.

(by EducEduc)

參考文件

  1. Dll methods are not invoked on windows server 2008 (CC BY‑SA 3.0/4.0)

#windows-server-2003 #windows-server-2008 #DLL #iis-7.5 #vb.net






相關問題

Metode Dll tidak dipanggil di windows server 2008 (Dll methods are not invoked on windows server 2008)

刪除窗口別名 (Removing windows aliases)

從 IIS 6 升級到 8.5:增加並發請求 (Upgrading from IIS 6 to 8.5: increased concurrent requests)

IOException 寫入事件日誌 (IOException writing to event log)

底層連接已關閉:接收時發生意外錯誤 (The underlying connection was closed: An unexpected error occurred on a receive)

Win2003終端服務器的小程序加載問題 (Applet loading problem with Win2003 Terminal Server)

確保在 Windows Server 2003 64 位上安裝了 ASP.NET 3.5 Framework (Ensure that ASP.NET 3.5 Framework is installed on Windows Server 2003 64-bit)

為沒有證書模板的 PKCS#10 CSR 頒發證書。0x80094801 MS W2K3企業CA (Issue certificate for a PKCS#10 CSR without Cert template. 0x80094801 MS W2K3 enterprise CA)

操作系統升級後無法從 ANT 訪問環境變量 (Can't access env vars from ANT after OS upgrade)

在 Windows 上自動啟動批處理文件 (Autostart a batch file on Windows)

為什麼從 PHP 腳本調用 (ImageMagick) convert.exe 會導致頁面無響應? (Why is calling (ImageMagick) convert.exe from PHP script resulting in an unresponsive page?)

即使在修補程序之後 SHA256 也無法正常工作 (SHA256 not working even after hotfixes)







留言討論