问题描述
我有一个现有的相当大的经典 asp 网站,其中配置了虚拟目录以集中某些资源.我的问题是由于某种原因我无法访问我的任何命名空间和类.我尝试添加对另一个项目的引用,其中我在命名空间DAL"中有类,即使智能感知看到这些类并且网站编译正常,当我尝试访问引用DAL"命名空间中的类的任何页面时它也会出错.
I have an existing fairly large classic asp website, with virtual directories configured to centralize certain resources. My problem is for some reason I can't access any of my namespaces and classes. I tried adding a reference to another project where I have classes in a namespace "DAL" and even though intellisense sees the classes and the website compiles fine, it errors when I try to access any page that references a class in the "DAL" namespace.
我在浏览器中收到以下错误消息CS0103:当前上下文中不存在名称 'CMS'".部分问题是网站项目的根目录与 IIS 中的 Web 根目录不同的文件夹/级别.所以我的库位于网站根目录/bin"文件夹中,但 iis 正在较低级别的 IIS webroot 中查找这些文件.那么如何让 .net 看到我的二进制文件而不将它们放在较低的 IIS 网站根目录中呢?我尝试为我的 .dll 文件设置一个虚拟目录,但似乎没有效果.
I get the following error message in my browser "CS0103: The name 'CMS' does not exist in the current context". Part of the problem is website project's root is not the same folder/level as the web root in IIS. So my libraries are in the website root "/bin" folder, but iis is looking for these files in the IIS webroot which is at a lower level. So how can I get .net to see my binaries without putting them in the lower IIS website root directory? I tried setting up a virtual directory to my .dll file but it seems to have no effect.
感谢您的帮助!
======================澄清=====================
我想要做的是将我希望我的网站使用的 .dll 文件保存在更高级别的目录中,然后是我在 IIS 中设置为 Web 根目录的文件夹.所以说我想在项目/bin文件夹中使用它DAL"的库,但在IIS下,默认站点的本地路径设置为/site/default".我似乎可以使用DAL"库的唯一方法是将/bin 文件夹放入/site/default/bin",这对于这个项目不是一个选项.这有帮助吗?
thank you for your help!
======================CLARIFICATION====================
What I'm trying to do is keep the .dll files I want my website to use in a higher level directory then the folder I have set as the web root in IIS. So say the library i want to use it "DAL" it in the projects /bin folder, but under IIS the default site's Local Path is set to "/site/default". The only way I can seem to use the "DAL" library is by putting the /bin folder into "/site/default/bin", which for this project is not an option. Does this help?
推荐答案
使用 NTFS 连接点来实现听起来对我来说相同的目标.
Using an NTFS Junction Point to achieve what sounds like the same goal has been working for me.
举个例子,我有一个包含 20 多个子 IIS 应用程序的网站,这些应用程序基本相同(不要问!),而不是在每个应用程序中复制bin"文件夹(它们是相同的)每个子应用程序都有一个bin"连接点,指向网站根目录中的bin"文件夹.
By way of an example, I have a web site with 20+ child IIS Applications that are largely identical (don't ask!), rather than duplicating the 'bin' folder in each of these (they would be identical) each child application has a 'bin' junction that points to the 'bin' folder in the web site root.
/bin <- this is the actual 'bin' folder
/app1
/app1/bin <- this is a junction point
/app2
/app2/bin <- this is a junction point
/app3
/app3/bin <- this is a junction point
/images
...
...
要创建这些连接点,如果您使用 Vista/Win2k8 或更高版本,您可以使用内置命令mklink",对于早期版本的 Windows,请使用 SysInternals junction.exe 工具 - 可用 这里.
To create these junction points, if you're using Vista/Win2k8 or later you can use the built-in command 'mklink', for earlier versions of Windows use the SysInternals junction.exe tool - available here.
这篇关于将 .net 代码添加到经典的 asp 网站,无法在 .dll 文件中引用命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!