为什么已发布的网站引用我的机器?
我有一个在 Visual Studio 2008 中发布的网站,然后发送给其他人。其中一个页面需要更改一些配置文件,因此使用网站引用的类库内的 WindowsImpersonationContext 执行操作。
protected void WithImpersonation(ExecuteUnderImpersonation action)
{
using(WindowsImpersonationContext context = Request.LogonUserIdentity.Impersonate())
{
action();
}
}
但是,当其他人尝试提交此页面时,它会抛出错误
无法将配置保存到文件“C:\Inetpub\wwwroot\SomeWebsite\web.config”。
查看 StackTrace 我看到这个条目:
在 SomeClassLibrary.SomeClass.WithImpersonation(ExecuteUnderImpersonation 动作)在FILEPATH FROM MY 机器:第 23 行
这似乎只发生在一个特定页面上,即使多个页面调用同一方法。
如果我已将网站(以可更新模式)发布到 PrecompiledWeb 文件夹,并在 bin 目录中使用适当的引用发布它,为什么它会在我的计算机上查找该类?该错误甚至没有意义,如果它正在寻找服务器上不存在的文件,那么他们不应该得到一个截然不同的错误吗?
我将同一个网站放在连接到该域的一台服务器上。如果我尝试从以我自己身份登录的服务器或在我的计算机上运行同一页面,则不会收到此错误。
一位同事之前曾说过,他们有时也会收到此错误,但它最终会消失。我们无法查明问题的原因,但如果在其他人的计算机上从 SVN 检出同一网站、发布然后发送出去,则根本不会发生此错误。
对于发生的事情有什么想法吗?
I have a website that I publish in Visual Studio 2008 and then send off to other people. One of the pages needs to alter a few configuration files, so an action is executed using WindowsImpersonationContext inside a class library referenced by the website.
protected void WithImpersonation(ExecuteUnderImpersonation action)
{
using(WindowsImpersonationContext context = Request.LogonUserIdentity.Impersonate())
{
action();
}
}
However when someone else tries to submit this page, it throws an error that it was
Unable to save config to file 'C:\Inetpub\wwwroot\SomeWebsite\web.config'.
Looking at the StackTrace I see this entry:
at
SomeClassLibrary.SomeClass.WithImpersonation(ExecuteUnderImpersonation
action) in FILEPATH FROM MY
MACHINE:line 23
This appears to be happening on only one specific page, even though multiple pages call this same method.
If I've published the website (in Updatable mode) to the PrecompiledWeb folder, and released it with the appropriate references in the bin directory, why does it look for the class on my machine? The error doesn't even make sense, if its looking for a file that doesn't exist on their server, shouldn't they be getting a much different error?
I took the same website and put it up on one of my servers connected to the domain. If I tried running that same page from the server logged in as myself, or on my machine, I don't receive this error.
A coworker has said before that they also receive this error sometimes, but that it eventually goes away. We can't pinpoint the cause of the issue, but if the same website were to be checked out of SVN on someone elses computer, published, and then sent off, this error doesn't happen at all.
Any ideas as to what is going on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,这是程序调试数据库(.PDB 文件)的一部分。好吧,你认为它引用你的机器的部分就是这样。
您确实应该使用构建服务器。 ;-) 但这是另一个话题了。
发生错误的原因可能是其他用户没有设置正确的 ACL 来保存到 Web 文件夹。
That's part of the Program Debug Database (.PDB file) as far as I know. Well, the part where you think it's referencing your machine that is.
You really should use a build server. ;-) But that's another topic.
The reason that error happens is because presumably the other users do not have the correct ACL's set to save to the web folder.
它只是编译应用程序时源文件的路径。我确信你的错误与此无关。我怀疑您的问题是,虽然您可能有权修改该文件,但大多数用户没有。检查文件/目录的权限,看看是否需要打开它。也许这种情况并不总是发生的原因是文件只需要更新一次,最终具有正确凭据的人可以访问它,然后每个人都可以修复它。
It's just the path to the source file when the application was compiled. I'm sure that your error isn't related to it. I suspect that your problem is that, while you may have permission to modify the file, most users don't. Check the permissions on the file/directory to see if you need to open it up. Perhaps the reason that it doesn't always happen is that the files only need to be updated once and eventually someone with the right credentials accesses it and it's then fixed for everyone.