Wrong path returned by Environment.GetFolderPath(Environment.SpecialFolder.ApplicationFolder) under IIS6 WebService

前端 未结 2 784
故里飘歌
故里飘歌 2020-12-21 13:01

On my test machine running (Windows XP, IIS5.1) the following code executed within a C# .NET WebService (.SVC) under a custom process identity (using machine.config to speci

2条回答
  •  醉酒成梦
    2020-12-21 13:28

    Yes. it's not a bug. Under which user is running the app pool??

    Let's split this a little:

    The Test Machine uses IIS to host the service or the built-in web server? If you use the built-in web server, it runs under your user. If you use IIS, which one is the pool user?

    If it is Network Service or Local System, the process runs under the context of one of those users, and indeed, the call to:

    Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) 
    

    is OK.

    You should change the user of the pool (and recycle the pool) to see the change.

提交回复
热议问题