移动 Bin 文件夹的位置,网络发布问题?

发布于 2025-01-07 15:25:43 字数 435 浏览 0 评论 0原文

我一直在开发一个 ASP.Net 网站,并且发布到我的服务器上没有任何问题。我决定将其发布路径更改为向下几个步骤,以便一切都将更符合逻辑地放置。

之前:C:/inetpub/wwwroot/(HERE)

在我得到了我想要的一切之后,我将其更改为向下 2 个步骤。

之后:C:/inetpub/wwwroot/super/duper/(这里)

直到我清理了 /wwwroot/ 中的顶级内容,一切才开始崩溃。我会收到错误消息,指出无法找到我的 .ashx 处理程序。愣了几个小时后,我把 /super/duper/bin/ 文件移到了顶层,/inetpub/wwwroot/bin/ 和 viola.txt 。它起作用了。

现在我的问题是,当 /bin/ 文件始终可以通过网络访问时,为什么会产生这种效果?

I have been working on an ASP.Net web site and have been publishing to my server with no issues. I decided to change the path that it was being published to a few steps down so that everything would be more logically placed.

Before : C:/inetpub/wwwroot/(HERE)

After I got everything how I wanted it i changed it to down 2 steps.

After : C:/inetpub/wwwroot/super/duper/(HERE)

It wasn't until I cleaned up the top level stuff that was just in /wwwroot/ that everything started to break. I would get errors saying that my .ashx handler couldn't be found. After staring blankly for a few hours, I moved my /super/duper/bin/ file to the top level, /inetpub/wwwroot/bin/, and viola. It worked.

Now my question is, why did this have this effect, when the entire time the /bin/ file was web accessable?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

千鲤 2025-01-14 15:25:43

我认为其他答案和这个问题所暗示的是,仅仅将文件夹移动到您希望从中引用站点的位置,更重要的是从中运行代码是不够的。我认为你有两个选择。

选项 1.

将 bin 文件夹保留在 WWWROOT 级别,但将其他项目移至所需的文件夹结构中。运行时会将 bin 文件夹中的 dll 加载到应用程序池中,您的 aspx 等应该可以看到它。

选项 2.

在您想要的级别创建一个虚拟文件夹/应用程序,并将所有内容放入其中。

我认为选项 2 更好。

另外,如果您的网址中没有使用 ~,您可能需要看一下。

I think what the other answers and this question is alluding to is that it is not enough just to move the folder to the location that you wish to reference your site from and more importantly run your code from. The way I see it is you have two options.

Option 1.

Leave the bin folder at the WWWROOT level but move the other items into the folder structure you want. The runtime will load the dll in the bin folder into the app pool and your aspx's etc. should see it.

Option 2.

Create a virtual folder / application at the level you want and drop everything in there.

Option 2 is better I think.

Also if you are not using ~ in your urls you might want to take a look at that.

看轻我的陪伴 2025-01-14 15:25:43

bin 目录是已编译程序集所在的系统目录,除非它们不在 GAC 中。 Bin 目录应位于站点根文件夹中。除非您有自己的程序集注册模块或不动态加载它们:-)

bin directory is system directory where the compiled assemblies are located, unless they are not in GAC. Bin directory should be located in the site root folder. unless you have your own assembly registeration module or not loading them on the fly :-)

∞觅青森が 2025-01-14 15:25:43

ASP.NET 应用程序应放置在 IIS 中定义为“应用程序”的文件夹的根目录中。您可以在任何文件夹中创建应用程序。应用程序级别的内容(例如包含应用程序设置的 web.config 和 bin 文件夹)应直接放置在此应用程序文件夹中。在 IIS6 中,该应用程序称为虚拟目录。

An ASP.NET application should be placed in the root of a folder defined as Application in IIS. You can create an Application in any folder. Application level stuff like web.config containing application settings and the bin folder should be placed directly in this Application folder. In IIS6 the application is called virtual directory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文