Website not working in production server but works in development machine

deskcheck1-0579 411 Reputation points
2024-05-06T21:01:21.8033333+00:00

I'm using .NET Framework 4.8 and runtime 4.8 on production server running on Windows Server 2022 Standard.

I've deployed our website to the production server using Web Deploy 4.0 without any problem. The website works fine on the development machine (no errors).

Why is it that when I run it on the production machine I get "Server Error in '/' Application." I have <customErrors mode="RemoteOnly"/> tag in my web.config file. I also have a <httpErrors errorMode="Detailed"/> tab in the web.config file. HSTS is enabled as well as SSL certificate.

Why am I getting an error?

Appreciate any response.

Internet Information Services
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,373 questions
{count} votes

4 answers

Sort by: Most helpful
  1. AgaveJoe 26,581 Reputation points
    2024-05-06T22:24:51.8866667+00:00

    Why is it that when I run it on the production machine I get "Server Error in '/' Application."

    Usually the error message has a bit more information than what you've shown.

    The setting mode="RemoteOnly" means remote clients see a custom error message while users logged in to the web server can see the actual exception. If you have the capability to remote (login) into the server, then you can see a detailed error by using the server's browser to access the web site. Otherwise; set the custom errors mode to off and re-deploy. This will allow you to see the detailed error message from a remote browser.

    It's typically a simply fix once you can see the exception and stack trace.

    0 comments No comments

  2. hossein jalilian 4,460 Reputation points
    2024-05-06T22:30:42.81+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    There are a few steps you can take to troubleshoot and diagnose the problem:

    • Ensure that the application pool identity has the necessary permissions to access the files and resources required by your application.
    • Verify that all required dependencies and libraries are properly installed and configured on the production server. This includes any third-party libraries or components that your application relies on.
    • Ensure that the SSL certificate is properly configured and bound to the website in IIS.
    • On the production server, check the Windows Event Viewer for any ASP.NET-related error messages. Look for entries under the "Application" or "System" logs that may provide more information about the error that's occurring.

    If these steps don't resolve your issue, consider enabling error mode in the configuration file to view detailed error information and identify the root cause.

     <customErrors mode="Off" />
    
    
    

    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful

    0 comments No comments

  3. Sam Wu-MSFT 7,126 Reputation points Microsoft Vendor
    2024-05-08T08:36:29.4266667+00:00

    @deskcheck1-0579

    There are many reasons for this error, you can try below solution:

    You might have to set the application pool for your site in IIS to allow 32bit applications if you're using a 32-bit(even on a 64-bit system). The application pool is 64-bit by default. Right-click on the Application Pool > Advanced Settings > 'Enable 32-bit Applications' set that to true.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  4. Bruce (SqlWork.com) 58,856 Reputation points
    2024-05-12T17:09:45.72+00:00

    Generally the most common errors are permission errors. Be sure the app pool account has the correct permissions including access to the website folder. Often the account needs to be a domain account. When run locally the site runs under your account.

    0 comments No comments