The hosting provider for one of the web sites I manage has forced us to only be able to modify the site as a web project instead of as a web application. When it was initially a web application it was working fine, but after converting to a web site project I had many issues involving missing namespaces and references and was able to resolve them by placing all of my libraries inside of the top-level App_Code folder of the web site. I have one last issue with my linq-to-sql class - in Visual Studio the class is recognized now that it's in the top level App_Code folder, but when I call a page which references it I get the following error:
我管理的其中一个网站的托管服务提供商迫使我们只能将网站修改为Web项目而不是Web应用程序。当它最初是一个Web应用程序时,它工作正常,但在转换为网站项目后,我遇到了很多涉及缺少命名空间和引用的问题,并且能够通过将所有库放在顶层的App_Code文件夹中来解决这些问题。网站。我的linq-to-sql类有一个最后一个问题 - 在Visual Studio中,类现在被识别为位于*App_Code文件夹中,但是当我调用引用它的页面时,我收到以下错误:
The type or namespace name 'LIFH_IntakesDataContext' could not be found (are you missing a using directive or an assembly reference?)
找不到类型或命名空间名称'LIFH_IntakesDataContext'(您是否缺少using指令或程序集引用?)
Initially there was no namespace whatsoever, but in my attempts to fix this I addded a "LIHS" namespace and placed the Data Context within that:
最初没有任何命名空间,但在我尝试修复此问题时,我添加了一个“LIHS”命名空间并将数据上下文置于其中:
Here are the references for the site:
以下是该网站的参考资料:
And here is the Build configuration:
这是Build配置:
And, here is my directory structure (Linq-to-SQL class is referenced in the circled "reports.aspx" page):
并且,这是我的目录结构(Linq-to-SQL类在带圆圈的“reports.aspx”页面中引用):
Code in reports.aspx:
reports.aspx中的代码:
Both the master page and the reports page are both in the LIHS namespace.
主页面和报告页面都在LIHS名称空间中。
I am developing on Visual Studio 2012 and the application pool is set to .NET 2.0. The hosting provider does not allow anything above 2.0.
我正在Visual Studio 2012上开发,应用程序池设置为.NET 2.0。托管服务提供商不允许高于2.0的任何内容。
I have researched and found many references to my issue but most of them solve the problem by converting to a web application, which I cannot do, or by changing the target framework or by using a namespace, which I have done, but to no avail. I would appreciate any insight on this.
我已经研究并发现了许多对我的问题的引用,但是大多数都是通过转换为Web应用程序来解决问题,我无法做到这一点,或者通过更改目标框架或使用命名空间,我已经完成了,但无济于事。我很感激任何有关这方面的见解。
1 个解决方案
#1
0
Pay Attention: Linq is only available in .Net 3.5 and later
If you are using .net 2.0 it wont work.
注意:Linq仅适用于.Net 3.5及更高版本如果您使用.net 2.0则无法使用。
You can see it in your screenshot.
您可以在截图中看到它。
Hope it helps.
Mike
希望能帮助到你。麦克风
#1
0
Pay Attention: Linq is only available in .Net 3.5 and later
If you are using .net 2.0 it wont work.
注意:Linq仅适用于.Net 3.5及更高版本如果您使用.net 2.0则无法使用。
You can see it in your screenshot.
您可以在截图中看到它。
Hope it helps.
Mike
希望能帮助到你。麦克风