Sql server 设计WCF服务以使用字节数组推送数据参数?
我设计了WCF服务,其中包含可以在SQL server数据库中存储数据的操作契约。操作契约采用数据ID、数据描述、数据类型和(字节数组)数据内容等参数。字节数组最初是一个必须存储在数据库中的文件 我在web表单客户端应用程序(其中引用了WCF服务)中使用了WCF服务来发送数据,但当我使用其他参数将大于40 kb的文件作为字节数组发送时,它返回bad request 400 error。当我发送小于30KB左右的文件时,数据成功存储在DB中,不会返回任何错误 我相信这与大数据流以及在web.config中将大小更改为更大的数字有关。我曾尝试更改客户端应用程序web配置中的大小,但没有成功。还将编码标记更改为MTOM,以返回不匹配的客户端和服务绑定。我正在使用wsHttpBinding 不知道问题出在哪里。 我读过: 但是,在将数据存储到数据库的同时,如何更改当前的wcf服务以启用该功能呢 我的服务器配置文件,服务库中的App.config是:Sql server 设计WCF服务以使用字节数组推送数据参数?,sql-server,database,wcf,wcf-client,Sql Server,Database,Wcf,Wcf Client,我设计了WCF服务,其中包含可以在SQL server数据库中存储数据的操作契约。操作契约采用数据ID、数据描述、数据类型和(字节数组)数据内容等参数。字节数组最初是一个必须存储在数据库中的文件 我在web表单客户端应用程序(其中引用了WCF服务)中使用了WCF服务来发送数据,但当我使用其他参数将大于40 kb的文件作为字节数组发送时,它返回bad request 400 error。当我发送小于30KB左右的文件时,数据成功存储在DB中,不会返回任何错误 我相信这与大数据流以及在web.con
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="IncidentServiceLibrary.IncDataService">
<endpoint address="" binding="wsHttpBinding" contract="IncidentServiceLibrary.IIncDataService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/IncidentServiceLibrary/Service1/" />
</baseAddresses>
</host>
</service>
</services>
<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="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<connectionStrings>
.....
</connectionStrings>
</configuration>
.....
调用我的服务的客户端中的客户端配置文件,Web.config:
...
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IIncDataService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2000000" maxNameTableCharCount="2000000" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8732/Design_Time_Addresses/IncidentServiceLibrary/Service1/" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IIncDataService" contract="IncServiceReference1.IIncDataService" name="WSHttpBinding_IIncDataService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" /></system.serviceModel>
</configuration>
。。。
你能在定义了wcf服务的地方发布你的客户端和服务器配置文件吗。如您所见,我已将中的值更改为足够大的数字。我在其他的帖子和网站上看到了这一点。这没有帮助。应该在服务器端和客户端上设置读卡器配额设置和绑定设置。我在服务器端看不到任何相同的设置OK right,因此我按照此处的说明在服务器端的App.config中设置了相同的设置:我现在可以将大数据发送到存储在数据库中的wcf服务,当前设置可能约为2GB。但这是发送大数据的正确方式吗?我相信我是在SOAP HTTP消息本身中发送文件数据的,这样做是不对的?