Wcf Windows Azure maxReceivedMessageSize集
我想发送给WCF WebRole的大量数据有问题。 我得到(413)太大的数据错误。我对Azure和WCF很陌生。我创建了一个向WCF(LargeObject.svc)发送图像的新服务,并尝试为其配置绑定和端点 这是服务器端代码:Wcf Windows Azure maxReceivedMessageSize集,wcf,azure,Wcf,Azure,我想发送给WCF WebRole的大量数据有问题。 我得到(413)太大的数据错误。我对Azure和WCF很陌生。我创建了一个向WCF(LargeObject.svc)发送图像的新服务,并尝试为其配置绑定和端点 这是服务器端代码: <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IImage" maxReceivedMes
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IImage" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="32"
maxArrayLength="200000000"
maxStringContentLength="200000000"/>
</binding>
<binding name="BasicHttpBinding_IRouteService"/>
</basicHttpBinding>
<customBinding>
<binding name="CustomBinding_IRouteService">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://dev.virtualearth.net/webservices/v1/routeservice/routeservice.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IRouteService"
contract="Route.IRouteService" name="BasicHttpBinding_IRouteService" />
<endpoint address="http://dev.virtualearth.net/webservices/v1/routeservice/routeservice.svc/binaryHttp"
binding="customBinding" bindingConfiguration="CustomBinding_IRouteService"
contract="Route.IRouteService" name="CustomBinding_IRouteService" />
<endpoint address="http://127.0.0.1:81/Implementation/LargeObject.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IImage"
contract="ILargeObject" name="BasicHttpBinding_IImageSvc"/>
</client>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
<dataContractSerializer maxItemsInObjectGraph="1048576" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
我还试图通过设置maxRevieved和maxBuffered属性在客户端配置BasicHttpBinding,但仍然不起作用
有什么想法吗
p、 这是一个Windows Azure WCF项目,因此我有一个默认端点-但我不知道如何将其设置为maxReceivedMessageSize。我在stackoverflow上找到了以下链接,他们也有同样的问题,希望它也适用于您 当您在MaxReceivedMessageSize中设置了要传输的最大字节数时,我认为您应该在ReaderQuotas标记中这样做 另一件事,你必须考虑,我不知道你使用的是什么类型的存储,但有些存储不允许你上传超过4MB的文件。例如,对于每个blockblob,块的最大大小为4 MB,对于pageblob,最大大小为4 MB
您也可以在msdn上查看此链接,他们有相同的问题:非常感谢。我没有注意到我总是设置“name”属性。现在,没有它,我的装订是“德高一号”。再次感谢。
string endPointAddress = (Application.Current as TravelerMobile.App).ServerUriString("LargeObject.svc");
LargeObjectClient client = new LargeObjectClient(new BasicHttpBinding(),
new EndpointAddress(endPointAddress));
MemoryStream stream = new MemoryStream();
WriteableBitmap wb = new WriteableBitmap(image);
wb.SaveJpeg(stream, image.PixelWidth, image.PixelHeight, 0, 100);
byte[] byteImage = stream.ToArray();
client.AddImageAsync(new LargeObject.AddImageRequest
{
Image = byteImage,
Latitude = latitude,
Longitude = longitude,
UserId = Helpers.GetUserId()
});