簡體   English   中英

使用VS2010在C#上Wininet.dll錯誤

[英]Wininet.dll Error on C# using VS2010

我的C#代碼有問題(我正在使用VS2010),我嘗試使用wininet.dll使用它的FTP函數。 DLL不是.NET組件,因此我無法添加作為參考,而是使用了在互聯網上看到的以下代碼,這是代碼:

[System.Runtime.InteropServices.DllImport("wininet.dll", CharSet = System.Runtime.InteropServices.CharSet.Ansi, SetLastError = true)]
    extern public static long InternetOpen(
        string lpszAgent,
        long dwAccessType,
        string lpszProxyName,
        string lpszProxyBypass,
        long dwFlags);

保存和構建項目時我沒有遇到任何錯誤,但是當我嘗試調試時收到一個錯誤,該錯誤的一部分說“ Culture = neutral,PublicKeyToken = null”,因為方法“ InternetOpen”沒有實現(無RVA)。”

我相信該錯誤是因為它看不到實際的wininet.dll文件,我嘗試將該文件放在項目文件所在的文件夾中,但沒有解決問題。 希望你們能幫助我。 提前致謝!

運行時可能找不到該簽名的入口點,因為根據P / Invoke.net,簽名如下所示:

[DllImport("wininet.dll", SetLastError=true, CharSet=CharSet.Auto)]
static extern IntPtr InternetOpen(string lpszAgent, 
                                  int dwAccessType, 
                                  string lpszProxyName, 
                                  string lpszProxyBypass, 
                                  int dwFlags);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM