Site works fine when it is run locally. But after it is published in 2019 windows server, it gives "HTTP Error 500.0 - Internal Server Error"

Julia Kurakula 41 Reputation points
2022-12-06T11:11:49.46+00:00

We are using IIS server 10 and .Net TrargetFramework ="4.7" in web.config of the WebApp as well as .Net Framework of 4.7 is installed in server manager. Site works fine when it is run locally. But after it is published in windows server 2019, it throws"HTTP Error 500.0 - Internal Server Error".

HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.
Most likely causes:
•IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
•IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
•IIS was not able to process configuration for the Web site or application.
•The authenticated user does not have permission to use this DLL.
•The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.
Things you can try:
•Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
•Check the event logs to see if any additional information was logged.
•Verify the permissions for the DLL.
•Install the .NET Extensibility feature if the request is mapped to a managed handler.
•Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.
Detailed Error Information:
Module
ManagedPipelineHandler
Notification
ExecuteRequestHandler
Handler
PageHandlerFactory-Integrated-4.0
Error Code
0x00000000
Requested URL
https:/xyz.com:443/default.aspx
Physical Path
E:\inetpub\wwwroot\xyzWebApp\default.aspx
Logon Method
Negotiate
Logon User
NA\Kur111545
Request Tracing Directory
E:\inetpub\wwwroot\LOGS- XyzWebApp
More Information:
This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error.
View more information »
Microsoft Knowledge Base Articles:
•294807

These are the log file:
--Software: Microsoft Internet Information Services 10.0
--Version: 1.0
--Date: 2022-12-06 11:00:25
--Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2022-12-06 11:00:25 10.7.148.23 GET / - 443 - 10.7.148.23 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+Touch;+rv:11.0)+like+Gecko - 401 2 64 4876
2022-12-06 11:00:25 10.7.148.23 GET / - 443 - 10.7.148.23 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+Touch;+rv:11.0)+like+Gecko - 401 2 5 3622
2022-12-06 11:00:42 10.7.148.23 GET / - 443 NA\Kur111545 10.7.148.23 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+Touch;+rv:11.0)+like+Gecko - 500 0 0 1987

Attached request tracing error too.
error.png

These are the event logs:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 12/6/2022 5:00:42 AM
Event time (UTC): 12/6/2022 11:00:42 AM
Event ID: cb1dddbda9f84682a335d3ebe5c278b6
Event sequence: 8
Event occurrence: 1
Event detail code: 0

Application information:
Application domain: /LM/W3SVC/2/ROOT-1-133147980213422334
Trust level: Full
Application Virtual Path: /
Application Path: E:\inetpub\wwwroot\XyzWebApp\

Process information:
Process ID: 4212
Process name: w3wp.exe

Exception information:
Exception type: CommunicationException
Exception message: An error occurred while receiving the HTTP response to https://xyz-preprod-ws.com/xyzService.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at xyzWebApp.xyzWcf.xyzService.GetEmployeeID(GetEmployeeIDRequest request)
at xyzWebApp.xyzWcf.xyzServiceClient.GetEmployeeID(xyzwcfClientCredentials& credentials) in C:\Users\Kur111545\source\Workspaces\ Finance - xyz\xyz Web\PROD\xyzWebApp\xyzWebApp\Service References\xyzWcf\Reference.cs:line 21329
at xyzWebApp.xyzService.InitCredentials() in C:\Users\Kur111545\source\Workspaces\Finance - xyz\xyzWeb\PROD\xyzWebApp\xyzWebApp\xyzService.cs:line 33
at xyzWebApp.xyzService.GetPersId(Int32& persId) in C:\Users\Kur111545\source\Workspaces\ Finance - DSS xyz\xyzWeb\PROD\xyzWebApp\xyzWebApp\xyzService.cs:line 69
at xyzWebApp.Default.Page_Load(Object sender, EventArgs e) in C:\Users\Kur111545\source\Workspaces\Finance - DSS xyz\xyz Web\PROD\xyzWebApp\xyzWebApp\Default.aspx.cs:line 40
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

The underlying connection was closed: An unexpected error occurred on a receive.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

The client and server cannot communicate, because they do not possess a common algorithm
at System.Net.SSPIWrapper.AcquireCredentialsHandle(SSPIInterface SecModule, String package, CredentialUse intent, SecureCredential scc)
at System.Net.Security.SecureChannel.AcquireCredentialsHandle(CredentialUse credUsage, SecureCredential& secureCredential)
at System.Net.Security.SecureChannel.AcquireClientCredentials(Byte[]& thumbPrint)
at System.Net.Security.SecureChannel.GenerateToken(Byte[] input, Int32 offset, Int32 count, Byte[]& output)
at System.Net.Security.SecureChannel.NextMessage(Byte[] incoming, Int32 offset, Int32 count)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.ConnectStream.WriteHeaders(Boolean async)

Request information:
Request URL: https://xyz-preprod.com:443/default.aspx
Request path: /default.aspx
User host address: 10.7.148.23
User: NA\Kur111545
Is authenticated: True
Authentication Type: Negotiate
Thread account name: NA\np_xyz_svc

Thread information:
Thread ID: 9
Thread account name: NA\np_xyz_svc
Is impersonating: False
Stack trace: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at xyzWebApp.xyzWcf.xyzService.GetEmployeeID(GetEmployeeIDRequest request)
at xyzWebApp.xyzWcf.xyzServiceClient.GetEmployeeID(xyzwcfClientCredentials& credentials) in C:\Users\Kur111545\source\Workspaces\ Finance - DSS xyz \xyz Web\PROD\xyzWebApp\xyzWebApp\Service References\xyzWcf\Reference.cs:line 21329
at xyzWebApp.xyzService.InitCredentials() in C:\Users\Kur111545\source\Workspaces\ Finance - DSS xyz \xyz Web\PROD\xyzWebApp\xyzWebApp\xyzService.cs:line 33
at xyzWebApp.xyzService.GetPersId(Int32& persId) in C:\Users\Kur111545\source\Workspaces\ Finance - DSS xyz\xyzWeb\PROD\xyzWebApp\xyzWebApp\xyzService.cs:line 69
at xyzWebApp.Default.Page_Load(Object sender, EventArgs e) in C:\Users\Kur111545\source\Workspaces\ Finance - DSS xyz \xyz Web\PROD\xyzWebApp\xyzWebApp\Default.aspx.cs:line 40
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Internet Information Services
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,371 questions
Windows Server Migration
Windows Server Migration
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Migration: The process of making existing applications and data work on a different computer or operating system.
408 questions
{count} vote

Accepted answer
  1. Bruce (SqlWork.com) 55,686 Reputation points
    2022-12-06T17:41:18.21+00:00

    it appears you website tries to communicate with another site over ssl and can not create the connection. most likely the TSL level don't match. the remote server probably requires TSL 1.3 and server 2019 only supports 1.2

    https://learn.microsoft.com/en-us/windows/win32/secauthn/protocols-in-tls-ssl--schannel-ssp-

    you will need to have the remote site support lower TSL levels (if allowed). if not you will need to upgrade the server hosting the website.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Julia Kurakula 41 Reputation points
    2022-12-07T04:34:41.84+00:00

    Enabling TLS 1.2 in the code worked. Thanks!