It seems like there's a problem deploying an ASP.NET Core application to IIS, and encountering a failure when trying to execute a certain action.

hao zhang 0 Reputation points
2024-04-10T11:12:31.61+00:00

fail: Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer[2]
using Microsoft.InformationProtection.File 1.14.128

  Connection ID "18230571301796315198", Request ID "80000044-0002-fd00-b63f-84710c7967bb": An unhandled exception was thrown by the application.

  System.NotSupportedException: Serialization and deserialization of 'System.IntPtr' instances are not supported. Path: $.Result.TargetSite.MethodHandle.Value.

   ---> System.NotSupportedException: Serialization and deserialization of 'System.IntPtr' instances are not supported.

     at System.Text.Json.Serialization.Converters.UnsupportedTypeConverter`1.Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options)

     at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)

     at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)

     at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)

     at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)

     at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)

     at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)

     at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)

     at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)

     at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)

     at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)

     at System.Text.Json.Serialization.JsonConverter`1.TryWriteAsObject(Utf8JsonWriter writer, Object value, JsonSerializerOptions options, WriteStack& sta
Azure Information Protection
Azure Information Protection
An Azure service that is used to control and help secure email, documents, and sensitive data that are shared outside the company.
517 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. James Hamil 21,851 Reputation points Microsoft Employee
    2024-04-12T20:54:35.6366667+00:00

    Hi @hao zhang , the error message you provided indicates that there is an issue with serialization and deserialization of 'System.IntPtr' instances in your ASP.NET Core application. This error can occur when you are using a library or package that is not compatible with the version of .NET Core that you are using.

    To resolve this issue, you can try the following steps:

    1. Check the version of .NET Core that you are using in your application. Make sure that it is compatible with all the libraries and packages that you are using.
    2. Check if there are any updates available for the libraries and packages that you are using. If there are updates available, try updating them to the latest version.
    3. If the issue persists, try removing the library or package that is causing the issue and see if the application runs without errors. If it does, you may need to find an alternative library or package that is compatible with your version of .NET Core.
    4. If none of the above steps work, you can try debugging the issue by setting breakpoints in your code and stepping through it to identify the exact location where the error is occurring.

    Please let me know if you have any questions and I can help you further.

    If this answer helps you please mark "Accept Answer" so other users can reference it.

    Thank you,

    James

    0 comments No comments