发送图像从IOS asp.net web服务 [英] Send image to asp.net web service from IOS

查看:112
本文介绍了发送图像从IOS asp.net web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的iOS应用程序,我需要Ø发送图像的ASP.NET Web服务。我试图以字节为单位的形式和放大器的形象;然后将其转换回图像的形式在服务器端。
我现在用的这些线图像转换为字节IOS:

In my IOS app i need o send a image to ASP.NET Web Service . I am trying to the image in bytes form & then convert it back to image form on server side. Now i am using these line to convert image to bytes in IOS :

 NSData *imageData=UIImagePNGRepresentation([Mybutton currentBackgroundImage]);

此行​​得到734775字,这是太多的一个字节,因此它不能被发送SOAP请求。
所以,现在,我怎么acieve这一目标??????

this line give a bytes of 734,775 word, which is too much, so it can not be send a soap request . So , now how can i acieve this goal ??????

当调用服务usiong SOAP请求,然后它给了我这个错误:

when call the service usiong soap request then it gives me this error :

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body><soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>      System.Web.Services.Protocols.SoapException:
   There was an exception running the extensions specified in the config file. ---&gt; System.Web.HttpException: Maximum request length exceeded.
           at System.Web.HttpRequest.GetEntireRawContent()
          at System.Web.HttpRequest.get_InputStream()
         at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
         --- End of inner exception stack trace ---
       at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
         at    System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type,             HttpContext context, HttpRequest request, HttpResponse              response, Boolean&amp; abortProcessing)
</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>

我提出了茶亭一个应用程序,所以用户registeration我要上传用户图像到web服务器,当它寻找身边的人/她,然后还我想从Web服务返回IMAE
我该怎么办thse两件事情?
首先把Web服务器与放大器上的图像;然后从Web服务器检索。
非常感谢

I am making an app for chating , so on registeration of user i have to upload the user image to web server and when it search for people around him/her, then also i want to return imae from the web service how can i do thse two things ? First put image on web server & then retrieve from web server . Thanks A lot

推荐答案


  • 您可以减少使用JPEG图像的图像的记忆片段
    COM pression

  • You can reduce the memory footage of the image using JPEG image compression

    lowResolutionImage = [UIImage imageWithData:UIImageJPEGRepresentation(highResImage, quality)];
    

    ,其中质量在0.0和1.0之间

    where quality is between 0.0 and 1.0

    不要将图像作为原始二进制在互联网上转成二进制串的base64

    Don't send the image as raw binary over the internet turn the binary into base64 string

    由于一些媒体的流媒体文本的。你永远不知道一些
      协议可能跨preT的二进制数据作为控制字符,或
      您的二进制数据可能会搞砸了,因为底层协议
      可能会认为你已经进入了一个特殊的字符组合。

    because some media are made for streaming text. You never know some protocols may interpret your binary data as control characters , or your binary data could be screwed up because the underlying protocol might think that you've entered a special character combination.

    下面是<一个href=\"http://stackoverflow.com/questions/392464/how-do-i-do-base64-encoding-on-iphone-sdk/17571101#17571101\">link如何转换成的base64

    Here is the link on how to convert into base64


    • 当你使用的是IIS托管应用程序,则默认上传文件的大​​小如果为4MB。为了增加它,请在你的web.config使用一节

    • As you are using IIS for hosting your application, then the default upload file size if 4MB. To increase it, please use this below section in your web.config

      <configuration>
          <system.web>
              <httpRuntime maxRequestLength="1048576" />
          </system.web>
      </configuration>
      

      有关IIS7及以上的,你还需要添加下面的几行:

      For IIS7 and above, you also need to add the lines below:

      <system.webServer>
         <security>
            <requestFiltering>
             <requestLimits maxAllowedContentLength="1073741824" />
            </requestFiltering>
        </security>
      

      请注意:maxAllowedContentLength以字节为单位,而另一maxRequestLength以KB为单位,这也是为什么值这个配置示例不同。 (两者都是相当于1 GB)。

      Note: maxAllowedContentLength is measured in bytes while maxRequestLength is measured in kilobytes, which is why the values differ in this config example. (Both are equivalent to 1 GB.)

      下面是一个回答另一个疑问,想对您有所帮助。

      Here is an answer for another question that'd be helpful to you

      这篇关于发送图像从IOS asp.net web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆