【问题标题】:Cannot find classes once ASP.NET website is hosted托管 ASP.NET 网站后无法找到类
【发布时间】:2015-02-13 15:58:50
【问题描述】:

我的项目是一个连接到 SQL 数据库的 ASP.Net 网站。 它在 Visual Studio 中本地编译良好,但一旦托管 (myWindowsHosting.com) 就会引发此错误:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

 Compiler Error Message: CS0246: The type or namespace name 'IDefaultView' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 9:  namespace HFDB2
Line 10: {
Line 11:     public partial class Default : System.Web.UI.Page, IDefaultView
Line 12:     {
Line 13:         public event EventHandler btnNextClicked;

在此示例中,我尝试实现默认 Web 表单的接口。但是我尝试引用的任何类都会出现类似的错误。

为什么我的项目托管后找不到任何课程?

这跟我的文件夹结构有关系吗?

我的课程不在 App_Code 文件夹中,因为显然您不需要网站。无论如何,我尝试将它们放在 App_Code 文件夹中,但它给出了不同的错误。

请注意,我将您在项目文件夹中看到的所有内容都上传到了主机。

【问题讨论】:

  • 你不可能将你的源代码部署到服务器上吧?如果是这样,那么您应该部署已编译的 DLL。
  • 是的,我是。那么上图中的所有类都应该在 DLL 中?
  • 从不部署源代码。创建要部署的文件集合的最简单方法是使用 Visual Studio 中的“发布”选项。

标签: c# asp.net webforms hosting app-code


【解决方案1】:

我错误地部署了我的应用程序。正如本罗宾逊的评论所说:

永远不要部署源代码。创建要部署的文件集合的最简单方法是使用 Visual Studio 中的“发布”选项。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-01
    • 2023-03-16
    相关资源
    最近更新 更多