“CS0016: Could not write to output file” error when starting an app in IIS 7

后端 未结 13 943
广开言路
广开言路 2020-12-08 22:16

I am running Windows 7, and am not usually a developer in this setting, and have recently built a WCF Rest Service in C#, that I\'m now trying to deploy to IIS just on my lo

相关标签:
13条回答
  • 2020-12-08 22:17

    For me the solution was a combination of the fixes described here. I had to give to the NETWORK_SERVICE account full control on

    C:\Windows\Temp

    and

    C:\Windows\Microsoft.NET\Framework[related framework]\Temporary ASP.NET Files\

    and also change the Application Pool Identity to NetworkService.

    Also do not forget to restart the IIS after you give full control to NETWORK_SERVICE on the Temp folders

    0 讨论(0)
  • 2020-12-08 22:27

    This KB resolved it for me, it appears that the temp file path was nonexistent in the OS environmental variables.

    http://support.microsoft.com/kb/825791

    0 讨论(0)
  • 2020-12-08 22:27

    I have permissions but I'm starting to get that error. "restart machine" works for me

    0 讨论(0)
  • 2020-12-08 22:29

    There're 3 step to do:

    1 - check if "Application Pool Identity" is NetworkService
    
    2 - NETWORK_SERVICE account needs full control on:
        . C:\Windows\Temp
        . C:\Windows\Microsoft.NET\Framework[related framework]\Temporary ASP.NET Files\
    
    3 - restart the IIS
    

    Error Solved

    You could also try re-running regiis. "%windir%\Microsoft.NET\Framework[related framework]\aspnet_regiis -i"

    0 讨论(0)
  • 2020-12-08 22:31

    On Windows 8/Server 2012 there is no support for aspnet_regiis any more. I tried reinstall using windows features: fail. I tried reinstalling IIS: fail. I tried reinstall through WebPI: fail.

    I solved the issue by setting the ACL's on the Windows Temp Directory.

    Here is a powershell that does the job:

    $dir = "C:\Windows\Temp"
    $acl = get-acl -path $dir
    $new = "IIS_IUSRS","Modify","ContainerInherit,ObjectInherit","None","Allow"
    $accessRule = new-object System.Security.AccessControl.FileSystemAccessRule $new
    $acl.SetAccessRule($accessRule)
    $acl | Set-Acl $dir
    
    0 讨论(0)
  • 2020-12-08 22:32

    Sounds like the account that the WCF service is running under does not have access to write to the "Temporary ASP.NET Files" directory.

    You could also try re-running regiis.

    %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis -i

    ASP.NET IIS Registration Tool (Aspnet_regiis.exe)

    0 讨论(0)
提交回复
热议问题