该问题必须在服务器端(自托管 HttpSelfHostServer 或 IIS)解决。
缓冲区必须设置为更高的值。
如果主机在 IIS 下运行:
配置 IIS
如果服务器作为 HttpSelfHostServer 运行:
您必须为配置参数设置更高的值(根据需要)。
vb.net 的示例
Dim cSelhostConfiguration As String = cIPADressePort
' Note: cIPADressePort contains the IP address and port on which the host is listen
Dim config As New HttpSelfHostConfiguration(cSelhostConfiguration)
'Set here the needed size (in bytes)
config.MaxBufferSize = 250000000
config.MaxReceivedMessageSize = 250000000
'
config.Routes.MapHttpRoute(
name:="DefaultApi",
routeTemplate:="api/{controller}/{id}",
defaults:=New With {.id = RouteParameter.Optional}
)
'
Using server As New HttpSelfHostServer(config)
Try
server.OpenAsync().Wait()
Console.WriteLine("")
Console.WriteLine("WebService started... ")
Console.WriteLine("Waiting for work...")
Catch aggEx As AggregateException
Console.WriteLine("Error loading Server")
End Try
Console.WriteLine()
Console.WriteLine("Press enter to close the server")
Console.ReadLine()
End Using