IIS7 blocks access to files in directories of a particular name.
Error
The remote server returned an error: (404) Not Found.
Cause
The error occurs when adding additional files to a package from a web path that contain blocked segment (directories.) This only occurs in IIS 7.0 and above because IIS blocks certain defined segments (directories) in the applicationHost.config file. The lists below are the filtered segments (directories) being blocked.
Web.config
bin
App_code
App_GlobalResources
App_LocalResources
App_WebReferences
App_Data
App_Browsers
Solutions
1. To remove the hidden segment form the applicationHost.config add the following near the bottom of the file, with other location tags.
<location path="sitename.com/subfolder/bin/debug">
<system.webServer>
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin" />
</hiddenSegments>
</requestFiltering>
</security>
</system.webServer>
</location>
2. To remove the hidden segment from with the share directory where the packages are stored, place the following lines of code in the web.config file. This is the recommended solution because this only affects the web share where the software distribution packages are being stored.
<?xml version="1.0"?>
<configuration>
<system.webServer>
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin" />
</hiddenSegments>
</requestFiltering>
</security>
</system.webServer>
</configuration>
3. To remove the hidden segment from the applicationHost.config type the following command with the segment (directory) to be removed from being blocked.
C:\Windows\System32\inetsrv\appcmd.exe set config "sitename.com/subfolder/bin/debug" -section:system.webServer/security/requestFiltering /-hiddenSegments.[segment='bin']
4. Verify the HTTP Binding are not limiting connections to a particular method, (i.e. IP address, NetBIOS, FQDN)
- Open Internet Information Services (IIS) Manager.
- Expand the Corename - Sites.
- Right click on Default Website, select Edit Bindings.
- For the HTTP and HTTPS types, make sure the IP Address and Binding Information columns are either blank or have an asterisk (*) in that place.
- Close the Site Binding, and try again.