通过WFC服务将大文件对象从win32应用程序上传到ms Sql server 2008 R2 [英] Upload large file object through WCF service into ms Sql server 2008 R2 from win32 application

查看:55
本文介绍了通过WFC服务将大文件对象从win32应用程序上传到ms Sql server 2008 R2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

我创建了WCF服务,允许基于桌面的应用程序通过wcf服务上传/下载大文件。

服务正常工作正常应该但问题是我无法从桌面应用程序上传大文件。我使用 Byte [] 将上传的文件直接存储到数据库中



这里是我的 web.config

---------------------------- ------


I have created WCF services which allow desktop based application to upload/download large file through wcf service.
The service is working working properly the way it should but the problem is that i can not upload large file from Desktop application. I am storing that uploaded file directly to the database using Byte[]

here is my web.config
----------------------------------

<?xml version="1.0"?>
<configuration>
  <connectionStrings>
  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime maxRequestLength="2147483647"/>
  </system.web>
  <system.serviceModel>

      <bindings>

      <basicHttpBinding>

        <binding name="BasicHttpBinding_IFileHandlerDuplex" closeTimeout="01:10:00"

         openTimeout="01:10:00" receiveTimeout="01:10:00" sendTimeout="01:10:00"

         allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

         maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"

         messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"

         useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"

           maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"

             realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings> 
    <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"/>
             <!--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="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>











你能告诉我怎样做才能使用WCF服务从数据库上传/下载大数据/文件?






can you tell what should i do to upload/download large to/file from database using WCF service ?

推荐答案

如果它在浏览器中工作,它也可以在应用程序中运行。我的猜测是你必须指定一些参数如超时等才能使它工作(在桌面应用中!)。
if it is working in a browser, it will work in an app as well. my guess is that you have to specify some parameteres like timeout, etc. to get it to work (in the desktop app!).


这里是应用程序的app.config文件< br $> b $ b

----------------------------------- ----------------

here is my app.config file of the application

---------------------------------------------------
<configuration>
    <system.servicemodel>
        <bindings>
            <basichttpbinding>
                <binding name="Service1Soap" closetimeout="01:00:00" opentimeout="01:00:00">
                    receiveTimeout="01:00:00" sendTimeout="01:00:00" allowCookies="false"
                    bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384">
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientcredentialtype="None" proxycredentialtype="None">
                            realm="" />
                        <message clientcredentialtype="UserName" algorithmsuite="Default" />
                    </transport></security>
                </readerquotas></binding>
                <binding name="BasicHttpBinding_ICAIS__AdvisiorWebService" closetimeout="01:00:00">
                    openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384">
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientcredentialtype="None" proxycredentialtype="None">
                            realm="" />
                        <message clientcredentialtype="UserName" algorithmsuite="Default" />
                    </transport></security>
                </readerquotas></binding>
                <binding name="BasicHttpBinding_ICAIS__AdvisiorWebService1" closetimeout="01:00:00">
                    openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="11655360" maxBufferPoolSize="524288" maxReceivedMessageSize="11655360"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerquotas maxdepth="32" maxstringcontentlength="1181920" maxarraylength="11163840">
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientcredentialtype="None" proxycredentialtype="None">
                            realm="" />
                        <message clientcredentialtype="UserName" algorithmsuite="Default" />
                    </transport></security>
                </readerquotas></binding>
                <binding name="BasicHttpBinding_ICAIS_ManagerWebService1" closetimeout="00:01:00">
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384">
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientcredentialtype="None" proxycredentialtype="None">
                            realm="" />
                        <message clientcredentialtype="UserName" algorithmsuite="Default" />
                    </transport></security>
                </readerquotas></binding>
                <binding name="BasicHttpBinding_ITransferService" closetimeout="00:01:00">
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384">
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientcredentialtype="None" proxycredentialtype="None">
                            realm="" />
                        <message clientcredentialtype="UserName" algorithmsuite="Default" />
                    </transport></security>
                </readerquotas></binding>
            </basichttpbinding>
        </bindings>
        <client>

</client></system.servicemodel></configuration>


Quote:

Hi Kalpesh,

Your appconfig file has the restriction, change the below parameters as mentioned. And after changing write click your service reference and click Update Service Reference option.

Hi Kalpesh,
Your appconfig file has the restriction, change the below parameters as mentioned. And after changing write click your service reference and click Update Service Reference option.




maxBufferSize="65536000" maxBufferPoolSize="524288000" maxReceivedMessageSize="65536000"  maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="8192" maxNameTableCharCount="2147483647"





Thanks and regards,

Bluesathish



Thanks and regards,
Bluesathish


这篇关于通过WFC服务将大文件对象从win32应用程序上传到ms Sql server 2008 R2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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