使用PhoneGap将图像上载到.NET WCF Rest服务

使用PhoneGap将图像上载到.NET WCF Rest服务,wcf,cordova,wcf-rest,Wcf,Cordova,Wcf Rest,我面临从相机和画廊上传文件的问题 从gallery中选择少量图像时,我能够成功地将图像上载到WCF服务。因此,WCF服务工作正常,上传文件的代码也工作正常,同样的代码也适用于模拟的网络摄像头 然而,当从图库中选择一些图像时,我得到*错误代码* java.io.FileNotFoundException:http://www.foobar.com/sasas JavaScript代码 请帮助我确定我做错了什么。您的PhoneGap代码似乎没有问题,但请检查您的WCF服务web.config文件 您

我面临从相机和画廊上传文件的问题

从gallery中选择少量图像时,我能够成功地将图像上载到WCF服务。因此,WCF服务工作正常,上传文件的代码也工作正常,同样的代码也适用于模拟的网络摄像头

然而,当从图库中选择一些图像时,我得到*错误代码*

java.io.FileNotFoundException:http://www.foobar.com/sasas

JavaScript代码


请帮助我确定我做错了什么。

您的PhoneGap代码似乎没有问题,但请检查您的WCF服务web.config文件

您将需要这样的内容来增加文件大小

<bindings>
    <basicHttpBinding>
        <binding name="basicHttp" allowCookies="true"
                 maxReceivedMessageSize="10000000" 
                 maxBufferSize="10000000"
                 maxBufferPoolSize="10000000">
            <readerQuotas maxDepth="32" 
                 maxArrayLength="100000000"
                 maxStringContentLength="100000000"/>
        </binding>
    </basicHttpBinding>
</bindings>


其中
100000000
是您的文件大小。

您的PhoneGap代码似乎没有问题,但只需检查您的WCF服务web.config文件即可

<bindings>
    <basicHttpBinding>
        <binding name="basicHttp" allowCookies="true"
                 maxReceivedMessageSize="10000000" 
                 maxBufferSize="10000000"
                 maxBufferPoolSize="10000000">
            <readerQuotas maxDepth="32" 
                 maxArrayLength="100000000"
                 maxStringContentLength="100000000"/>
        </binding>
    </basicHttpBinding>
</bindings>
您将需要这样的内容来增加文件大小

<bindings>
    <basicHttpBinding>
        <binding name="basicHttp" allowCookies="true"
                 maxReceivedMessageSize="10000000" 
                 maxBufferSize="10000000"
                 maxBufferPoolSize="10000000">
            <readerQuotas maxDepth="32" 
                 maxArrayLength="100000000"
                 maxStringContentLength="100000000"/>
        </binding>
    </basicHttpBinding>
</bindings>

其中
100000000
是您的文件大小。

这对我很有用

<bindings>
    <basicHttpBinding>
        <binding name="basicHttp" allowCookies="true"
                 maxReceivedMessageSize="10000000" 
                 maxBufferSize="10000000"
                 maxBufferPoolSize="10000000">
            <readerQuotas maxDepth="32" 
                 maxArrayLength="100000000"
                 maxStringContentLength="100000000"/>
        </binding>
    </basicHttpBinding>
</bindings>
问题在于WCF服务。它接受的文件小于65 KB,这是在增加
maxReceivedMessageSize
值后默认的最大请求大小。问题得到解决

<standardEndpoint name="" 
    helpEnabled="true" 
    automaticFormatSelectionEnabled="true" 
    maxBufferSize="2147483647" 
    maxReceivedMessageSize="2147483647"> 
</standardEndpoint> 

这对我很有效

问题在于WCF服务。它接受的文件小于65 KB,这是在增加
maxReceivedMessageSize
值后默认的最大请求大小。问题得到解决

<standardEndpoint name="" 
    helpEnabled="true" 
    automaticFormatSelectionEnabled="true" 
    maxBufferSize="2147483647" 
    maxReceivedMessageSize="2147483647"> 
</standardEndpoint> 


您是否检查了权限设置?可能不允许访问文件。@马里奥,谢谢你的回复。未经许可不得发布。这似乎是WCF服务的问题。它的接受文件小于65 KB,这是在增加WCF请求值后默认的最大请求大小。问题已解决。您碰巧有WCF服务的代码吗?我遇到无法从cordova文件传输上载图像的问题?您是否检查了权限设置?可能不允许访问文件。@马里奥,谢谢你的回复。未经许可不得发布。这似乎是WCF服务的问题。它的接受文件小于65 KB,这是在增加WCF请求值后默认的最大请求大小。问题已解决。您碰巧有WCF服务的代码吗?我遇到了无法从cordova文件传输上传图像的问题?