无法部署 Aspx 网站,App_code 文件夹类变得不可读
我最近完成了网站的创建,因此我已经到了必须将其部署到实时服务器的阶段,但是在复制时,所有 App_Code、App_Data 和 Bin 文件夹项目都变得无法访问。当我在开发服务器上运行时,所有类都很好,但是一旦文件经过(完全按照原样),我就无法再从 App_code 文件夹创建对象实例(非常重要)。
我收到的错误是一个非常通用的错误消息。
CS0246:找不到类型或命名空间名称“Display”(您是否缺少 using 指令或程序集引用?)
我之前从未需要为 App_Code 中的代码声明命名空间,因此我认为该错误并不完全准确。文件和文件夹的权限也是相同的。
当我在部署的网站上使用智能感知时,它确实可以识别对象。然而一旦编译就无法使用。
任何帮助将不胜感激。
I have recently finished creating my website, I have therefore come to the stage where I have to deploy it to a live server however when copying across, all of the App_Code, App_Data and Bin folder items become unaccessible. All of the classes are fine when I run on my dev server but once the files go across (exactly as they are) I can no longer create instances of objects from the App_code folder (very important).
The error I get is a quite generic error message.
CS0246: The type or namespace name 'Display' could not be found (are you missing a using directive or an assembly reference?)
I have never needed to declare a namespace for the code in App_Code before so I presume the error is not completely accurate. The permissions on files and folders are also the same.
When I use intelisense on the deployed website, it does recognise the objects. However once Comiled are not usable.
Any help would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当您迁移到新服务器时,是否缺少参考?
检查项目的引用文件夹和项目设置。如果您使用 GAC 中的任何内容,请确保 .dll 已标记为本地复制。如果是这样,您可能需要将 .dll 部署到生产服务器才能正常工作。
Do you have a missing refrence when you move to the new server?
Check your project's refrence folder and project settings. Make sure the .dlls are marked copy local and if your using anything from the GAC. If so you may need to deploy the .dll to the production server for things to work.
您是手动复制站点的文件(例如,使用 FTP 客户端)还是使用复制网站工具(“网站”菜单、“复制网站...”菜单项)?我希望该工具可以帮助您整齐地复制所有必要的文件。
您看到的错误消息不一定需要命名空间;它指的是一种没有命名空间的类型,或者在“using”语句中的命名空间之一中,称为“Display”,您在 ASPX 文件之一中引用了该类型。这可能是您放入 App_Code 文件夹中的一个。不用担心使用命名空间。
Are you manually copying the site's files (say, with an FTP client) or are you using the Copy Website tool ('Website' menu, `Copy Website...' menu item)? I'd hope the tool can help you get all the necessary files copied over neatly.
The error message you are seeing doesn't necessarily require namespaces; it's referring to a type with no namespace, or in one of the namespaces in your 'using' statements, called 'Display,' that you've referred to in one of your ASPX files. That;s pesumably one you've put in your App_Code folder. Don't worry about using namespaces.
我正在使用VS2008复制网站功能来部署网站。我之前不需要使用声明来访问应用程序代码,我认为它始终可以从网站内的任何位置访问。
我如何检查你提到的dll?
I am using the VS2008 Copy Website function to deploy the website. I have not needed to have a using declaration before to access the app code I presumed it was always accessible from anywhere within the website.
How do I check the dll which you mentioned?