10

I recently upgraded my web app to .NET 4.5. After pushing the code to our testing environment, I get a "404 - File or directory not found." error. The code runs fine from my VS2013 desktop. The web server is running IIS 7.5 on W2K08 R2. I can view .asp or .htm page on the site, but get this error when try to view the simplest of .aspx pages. I'm suspect it's a configuration issue with my web.config.

6
  • Can you show us your web.config and the applicationhost.config portion that relates to your website? Dec 2, 2016 at 18:02
  • Tried posting the web.config, but it's too long. What specifically would you like to see and I'll copy that section.
    – jbonwell
    Dec 2, 2016 at 18:28
  • In order to help find out whats wrong we would need to see the configs, mainly the site specific portion. Usually the entire web.config is helpful. In the applicationhost.config for your issue the <site> container should be fine. Dec 2, 2016 at 18:30
  • To long? you will have to post it here, use notepad++ to find and replace \n with 4 spaces at the begining of each line stackoverflow.com/questions/11003761/notepad-add-to-every-line Dec 2, 2016 at 18:34
  • <site name="SHIPPING" id="10067" serverAutoStart="true"> <application path="/CPORT" applicationPool="ASP.NET v4.0 Classic"> <virtualDirectory path="/" physicalPath="E:\inetpub\wwwroot\WEB_APPS\CPORT" /> </application> <bindings> <binding protocol="http" bindingInformation="136.171.92.24:80:stage.chx.com" /> </bindings> <logFile logExtFileFlags="Date, Time, ClientIP, UserName, SiteName, ComputerName, ServerIP, Method, UriStem, UriQuery, HttpStatus, Win32Status, BytesSent" directory="E:\Inetpub\SHIPPING\Logs" /> </site>
    – jbonwell
    Dec 2, 2016 at 18:53

2 Answers 2

11

Here is the web.config. http://go.microsoft.com/fwlink/?LinkId=235367.

The following attributes can be set on the <httpRuntime> tag.
  <system.Web>
    <httpRuntime targetFramework="4.5.2" />
  </system.Web>
  -->
  <system.web>
    <httpRuntime requestValidationMode="4.0" enableHeaderChecking="false" encoderType="System.Web.Security.AntiXss.AntiXssEncoder,System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <httpCookies httpOnlyCookies="true"/>
    <compilation debug="true" strict="false" explicit="true">
      <assemblies>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Drawing.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
      </assemblies>
</compilation>
<trace enabled="false" pageOutput="false"/>
<pages theme="Apps" enableEventValidation="true" validateRequest="true" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
  <namespaces>
    <clear/>
    <add namespace="System"/>
    <add namespace="System.Collections"/>
    <add namespace="System.Collections.Generic"/>
    <add namespace="System.Collections.Specialized"/>
    <add namespace="System.Configuration"/>
    <add namespace="System.Text"/>
    <add namespace="System.Text.RegularExpressions"/>
    <add namespace="System.Linq"/>
    <add namespace="System.Web"/>
    <add namespace="System.Web.Caching"/>
    <add namespace="System.Web.SessionState"/>
    <add namespace="System.Web.Security"/>
    <add namespace="System.Web.Profile"/>
    <add namespace="System.Web.UI"/>
    <add namespace="System.Web.UI.WebControls"/>
    <add namespace="System.Web.UI.WebControls.WebParts"/>
    <add namespace="System.Web.UI.HtmlControls"/>
  </namespaces>
  <controls>
    <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add tagPrefix="Ipls" assembly="cvx.Ipls.Web" namespace="cvx.Ipls.Web.UI.Controls"/>
    <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI"/>
    <add tagPrefix="ccc" namespace="CSC.Web.Common.Controls" assembly="CSC.Web.Common.Controls35"/>
  </controls>
</pages>
<sessionState mode="InProc" timeout="60"/>
<httpHandlers>
  <add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" validate="false"/>
  <add path="*_AppService.axd" verb="*" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
  <add path="ScriptResource.axd" verb="GET,HEAD"  type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" /> 
</httpHandlers>
<httpModules>
  <add name="ErrorModule" type="CSC.Web.Common.Errors.ErrorModule"/>
  <add name="securityModule" type="CSC.Web.Common.Security.securityModule"/>
  <add name="RadCompression" type="Telerik.Web.UI.RadCompression"/>
</httpModules>
<identity impersonate="false"/>
  </system.web>
     <!-- 
    The system.webServer section is required for running ASP.NET AJAX under Internet
    Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
   <modules>
  <add name="ErrorModule" type="CSC.Web.Common.Errors.ErrorModule"/>
  <add name="securityModule" type="CSC.Web.Common.Security.securityModule"/>
  <add name="RadCompression" type="Telerik.Web.UI.RadCompression"/>
</modules>
<handlers>
  <add name="Telerik.Web.UI.WebResource.axd_*" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" preCondition="integratedMode"/>
  <add name="ScriptResource.axd_GET,HEAD" path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="integratedMode"/>
  <add name="*_AppService.axd_*" path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="integratedMode"/>
  <add name="*.asmx_*" path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="integratedMode"/>
</handlers>
<httpErrors errorMode="DetailedLocalOnly"/>
<defaultDocument>
  <files>
    <add value="Main.aspx"/>
  </files>
</defaultDocument>
 </system.webServer>
 <runtime>
 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <!--<dependentAssembly>
    <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
  </dependentAssembly>-->
 </assemblyBinding>
</runtime>
<location path="Telerik.Web.UI.WebResource.axd">
  <system.web>
    <authorization>
        <allow users="*"/>
    </authorization>
  </system.web>
</location>
<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_ITwoWayAsync">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://servername.com/InformationService/MasterDataService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITwoWayAsync" contract="MasterData.MasterDataService" name="BasicHttpBinding_ITwoWayAsync"/>
</client>
</system.serviceModel>
</configuration>
5
  • look in the iis access log and show us the exact entry that is tossing you a 404. That will help. for all we know "Main.aspx" isnt even in E:\inetpub\wwwroot\WEB_APPS\CPORT Are you going to yoursite/CPORT?
    – Jeff W.
    Dec 2, 2016 at 19:33
  • Here is the entry. 146.27.228.73, CT\jbpj, 12/2/2016, 13:39:12, W3SVC10067, HOU150W8AHV1590, 136.171.92.24, 280, 779, 1498, 404, 1260, GET, /cport/test.aspx, - If I change the page to test.htm, it comes up.
    – jbonwell
    Dec 2, 2016 at 19:42
  • does test.aspx actually exist on the filesystem in E:\inetpub\wwwroot\WEB_APPS\CPORT?
    – Jeff W.
    Dec 2, 2016 at 19:44
  • Yes, it does exist.
    – jbonwell
    Dec 2, 2016 at 19:47
  • Did you run the aspnet_regiis command as suggested above?
    – Jeff W.
    Dec 3, 2016 at 0:53
10

Look at the config you provided if all files are where they are suppose to be do the following.

For windows Server 2008 / 2008 R2

First Ensure that the .NET Framework 4.5.1 is installed

Run the following command from an elevated command prompt:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

Then Open Internet Information Services

Select the Server in the left treeview.

In the "IIS" section, open "ISAPI and CGI Restrictions".

For all items beginning with "ASP.NET v4.0", right click the item and select "Allow".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .