简体   繁体   English

BC30002:类型'MySqlConnection'未定义-一旦代码在Web服务器上

[英]BC30002: Type 'MySqlConnection' is not defined - once code is on Web Server

I am creating a web site in Visual Studio 2013 Web Express using ASP and VB. 我正在使用ASP和VB在Visual Studio 2013 Web Express中创建网站。 The code works 100% fine in localhost, but once I FTP transfer my files over to my school's server, it no longer works. 该代码在localhost中可以100%正常运行,但是一旦我通过FTP将文件传输到学校的服务器上,它就不再起作用。 The web server comes up with an error message (Title) and says it stopped at here: Web服务器出现错误消息(标题),并说它在此处停止:

Imports System.Data
Imports MySql.Data.MySqlClient

Partial Class Home
    Inherits System.Web.UI.Page

    Private conn As New MySqlConnection

I've read many people having problems with this before but they all only stated the same answers that I've tried (will list below) 我已经读过很多人对此有疑问,但他们都只说出了我尝试过的答案(将在下面列出)

  • First off, just want to remind everyone that this does work on my local computer 首先,只想提醒所有人,此操作在我的本地计算机上有效
  • I do have a working reference on my system to MySql.Data.dll 我的系统上确实有MySql.Data.dll的有效参考
  • I have tried several different versions of this 我已经尝试了几种不同的版本
  • I have tried not installing the Connector/Net for MySQL and ONLY referencing a MySql.Data.dll from within my Bin Folder. 我尝试过不安装MySQL连接器/网络,而只能从Bin文件夹中引用MySql.Data.dll。 This works, confirming that they should not have to install the Connector/Net on their server. 这有效,确认他们不必在服务器上安装连接器/网络。
  • It is in my Bin folder, which is located at the same level as my web pages 它位于我的Bin文件夹中,该文件夹与我的网页位于同一级别
  • When I have uploaded my web site to the FTP server with MySQL.Data.dll targeting .Net 4.0, it did display an error, saying this was too high of a target since my project is in .Net 3.5 当我将网站上传到具有针对.Net 4.0的MySQL.Data.dll的FTP服务器时,它的确显示了错误,因为我的项目位于.Net 3.5中,因此这表明目标值过高
  • As a note, the .Net files I am getting for MySQL.Data.dll target .Net 2.0, since that's the next lowest from 4.0 值得注意的是,我为MySQL.Data.dll获得的.Net文件目标是.Net 2.0,因为这是4.0之后的最低文件

Thanks to reading, any input is appreciated. 多亏了阅读,任何输入表示赞赏。 I'll supply as much information as I can if there's any questions. 如有任何问题,我将提供尽可能多的信息。

You don't put the image files under the Views folder. 您不要将图像文件放在“视图”文件夹下。 The URL you specify in the view is relative to the application itself, so you images folder should be under the project folder. 您在视图中指定的URL是相对于应用程序本身的,因此images文件夹应位于项目文件夹下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM