编辑2:我发现一些回复提到修改“数据类型”,那是标题吗?Content-Type
我确实尝试修改application/json
没有帮助的。
编辑:我仍然有这个问题,只是为了添加这个信息,我发送一个文件作为输入,这里是我发送的 HTTP 标头,我知道“接受”标头不是问题,因为我有另一个请求不会引起任何问题:
Host: localhost:26479 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://localhost:26479/Home/FileUploadBrowser Content-Type: multipart/form-data; boundary=---------------------------41184676334 Content-Length: 1104
我有以下控制器方法(仍在进行中):
Function uploadFileToAmazon(ByVal key As String) As ActionResult
Dim incomingStream As Stream = Me.Request.InputStream
Dim bucketName As String = ""
Dim accessKey As String = ""
Dim secretKey As String = ""
ConnectToAmazon(bucketName, accessKey, secretKey)
Dim client As AmazonS3 = Amazon.AWSClientFactory.CreateAmazonS3Client(accessKey, secretKey, RegionEndpoint.USEast1)
Dim titledRequest As PutObjectRequest
titledRequest = New PutObjectRequest
With titledRequest
.WithBucketName(bucketName)
.WithKey(key)
.WithInputStream(incomingStream)
End With
Dim response As S3Response = client.PutObject(titledRequest)
Return Json(New With {Key .success = "true", Key .msg = "uploaded"})
End Function
原始问题:这是我遇到的问题,由于某种原因,它在完成<pre>{"success":"true","msg":"uploaded"}</pre>
. 我很困惑,这个<pre>
标签是从哪里来的,我该如何摆脱它?谢谢