HttpWebRequest Won't Serialize

后端 未结 2 866
别跟我提以往
别跟我提以往 2021-01-21 11:22

I\'m getting the following error when I try to Serialize an HttpWebRequest

Type \'System.Net.KnownHttpVerb\' in Assembly \'System, Version=2.0.0.0, Cu

2条回答
  •  野的像风
    2021-01-21 11:36

    System.Net.HttpWebRequest serialization was marked as obselete in .NET 2.0.

    Official documents here:

    http://msdn.microsoft.com/en-us/library/aa497288.aspx

    From an app perspective this is the best outcome. The predominant bulk of an HttpWebRequest instance is IO state that is typically not directly rehydratable.

    As @Andrew-Rollings suggests instead implement a custom serialize to store/restore your request parameters, then recreate the HttpWebRequest instance from scratch.

提交回复
热议问题