English 中文(简体)
Why is a published website referencing my machine?
原标题:

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:InetpubwwwrootSomeWebsiteweb.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?

最佳回答

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.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签