IIS HTTP Error 404 for .cs and .config files


アトラシアン コミュニティをご利用ください。


プラットフォームについて: Server と Data Center のみ - この記事は、サーバーおよびデータセンター プラットフォームのアトラシアン製品にのみ適用されます。


Bitbucket is  unable to view .cs and .config files in commits or in pull requests and the following message appears when try to visualise a .cs or .config file in a commit:

Server Error

HTTP Error 404 - File or directory not found.

Description: The resource you are looking for might have been removed, 
had its name changed, or is temporarily unavailable.

Server Version Information: Internet Information Services 7.0.



  • Windows Server.
  • Internet Information Services (IIS) configured as reverse proxy.


When you install the .NET Framework and register ASP.NET for IIS it will by default tell IIS to not serve these files.

This is generally considered a safe choice being .cs and .config files sensitive in case you are deploying .NET applications.


Change the web.config for the website removing restrictions for file extensions served:

<?xml version="1.0" encoding="UTF-8"?>
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://internal_bitbucket_hostname:7990/{R:1}" />
                <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1" enabled="false" stopProcessing="true">
                    <match filterByTags="A, Area, Form, Img, Link, Script" pattern="^http(s)?://(.*@)?hostname:7990/(.*)" />
                    <action type="Rewrite" value="http{R:1}://{R:2}external_bitbucket_hostname.com/{R:3}" />
                    <preCondition name="ResponseIsHtml1">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
            <fileExtensions applyToWebDAV="false">
				<!-- The following statement removes all the request filtering -->
               <clear />

Note that now all the extensions will now be served by IIS if you want to tailor the change just to allow .cs and .config you can use the following section:

                <remove fileExtension=".cs" />
				<remove fileExtension=".config" />
                <add fileExtension=".cs" allowed="true" />
                <add fileExtension=".config" allowed="true" />

最終更新日 2017 年 8 月 31 日


Powered by Confluence and Scroll Viewport.