Upload file store in database
-
Monday, May 17, 2010 2:29 AM
Hi,
I am using silverlight 4 based application .
Actually i have to store any kind of file in my database and that file have no size criteria so could you please help for setting the maximum file size and store that file in database.
Thanks in advance.
All Replies
-
Monday, May 17, 2010 6:54 AM
check this article
most often you will use varbinary(max) data type in sql server to store this kind of data.
-
Tuesday, May 18, 2010 4:39 AM
Thanks for replying ..
I am using wcf service for communication database.
but wcf service accepts only 64 kb data file only.
what setting i have to do in wcf sertvice configuiration or client reference configuiration.
-
Tuesday, May 18, 2010 4:49 AM
You should send file using chunks, store to server temporary storage and then on final step, upload file to database
http://silverlightfileupld.codeplex.com/
http://slfileupload.codeplex.com/
-
Tuesday, May 18, 2010 6:59 AM
Thanks for replying ..but still i did'nt get the answer...Please help me out...
I am using wcf service for communication database.
but wcf service accepts only 16kb data file only.actually i am passing byte[] in wcf method and wcf is stroing that byte value in database.
what setting i have to do in wcf sertvice configuiration or client reference configuiration.
i have done all those setting still above to 20 kb file is not getting the service.
---------------------------------------------------------------------------------------------------------------------------------------------
Make sure your WCF service is configured properly. By default WCF minmizes the maximum number of characters you can upload (8,000) and max number of chars in the buffer and max number of items to serialize etc.
1) Under the tool menu find WCF service configuration Editor and open it. Open the Web.config under your Web project that host your service:
-
Click the Bindings folder and add a new basicHttpBinding give it a name something like "LargeBuffer".
-
Change the number in MaxBufferSize/MaxReceivedMessageSize/MaxArrayLenght/MaxBytesPerRead/MaxDepth/MaxNameTableCharCount/MaxStringContentLenght to a large number. Those fields are integer fields. So the max number you can enter is 2147483647 which is the upper limit of a integer.
-
Find the first endpoint under Service Folder for WCFSilverlightWeb.WCFService, Click the BindingConfiguration and select the "LargeBuffer" binding you just created.
-
Save the web.config.
2) Use the same WCF service configuration Editor to open ServiceReferences.ClientConfig file under your Silverlight project.
-
You should see your service under Client/EndPoints folder. Open that endpoint. That endpoint has bindingConfiguration set to BasicHttpBinding_[YourService]. Goto that binding and change the MaxBufferSize/MaxReceivedMessageSize(Just those 2 fields, not fields under the ReaderQuotasProperties) to the same large number you set in the Web.Config.
-
Save the Client Config file
Now i should be upload a file up to 4MB.but its not working wt to do....Plz tell me
-
-
Wednesday, May 19, 2010 3:16 AM
Please check this "Using WCF and silverlight to create a restful file upload utility":
-
Thursday, May 20, 2010 1:06 AM
thanks nangua for replying ....but wt link u suggest that is only for uploading maximum size file in server(web) folder.
my issue is that i am passing byte array to WCF service for storing that byte array data in database.
16 kb byte array data is going without any problem but after that any big size data is not connecting with service.
Please silverlight team suggest me proper link.....
-
Thursday, May 20, 2010 2:10 AMIncrease web service timeout and message quota in your (ServiceReferences.ClientConfig) http://usamawahabkhan.blogspot.com/2010/05/silverlight-load-large-data.html here is example
-
Thursday, May 20, 2010 2:47 AM
Hi usama,
i set the time first serviceReference.ClientConfig file. but did'nt get right response.
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" receiveTimeout="00:20:00" sendTimeout="00:20:00" openTimeout="00:20:00" closeTimeout="00:20:00"
i set that in web.config also...but no result...wt to do..
-
Monday, May 24, 2010 3:02 AM
hi silverlight team,
i am stuck on here please provide me the right solution for that in silverlight 4.0
thanks.
-
Monday, May 24, 2010 3:06 AM
Can you post the web.config file. and the servicereference.clientconfig file if you don't mind?
thanks
-
Monday, May 24, 2010 3:15 AM
hi shihalv,
this is my web.config...
=============================================================================
====================================================================
and this is service.clientconfig ...
====================================================================
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ISyngrafiiService" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647" closeTimeout="00:01:00"
openTimeout="00:10:00" receiveTimeout="01:00:00" sendTimeout="01:00:00">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:2358/SyngrafiiService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISyngrafiiService"
contract="SyngrafiiDataService.ISyngrafiiService" name="BasicHttpBinding_ISyngrafiiService" />
</client>
</system.serviceModel>
</configuration>
==============================================================================thanks
-
Monday, May 24, 2010 3:27 AM
can you change your binding from
<binding name="LargeBuffer" closeTimeout="00:01:00" openTimeout="00:10:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="655360" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483648" messageEncoding="Mtom" transferMode="Streamed" useDefaultWebProxy="true"> <!--maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" receiveTimeout="01:00:00" sendTimeout="01:00:00" openTimeout="00:20:00" closeTimeout="00:20:00" transferMode="Streamed" > <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />--> </binding>
to
<binding name="LargeBuffer" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding>
then configure serviceBehaviours like this
<serviceBehaviors> <behavior name="SampleServiceBehaviors"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> <dataContractSerializer maxItemsInObjectGraph="2147483647" /> </behavior> </serviceBehaviors>then use this service behaviour in your service like this
<service name="SilverAnnotation.SyngrafiiService" behaviorConfiguration="SampleServiceBehaviors"> <endpoint address="/BasicSoap" binding="basicHttpBinding" bindingConfiguration="LargeBuffer" name="basicHttpBinding" contract="SilverAnnotation.ISyngrafiiService" /> <!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />--> </service>
-
Monday, May 24, 2010 3:52 AM
hi shihalv,
it gives the Metadata publishing for this service is currently disabled. error..
from where it gets enable.
-
Monday, May 24, 2010 4:02 AM
Can you try removing this line?
<serviceMetadata httpGetEnabled="true" />
sorry this hsa to be a trial and error, i just pick up what we hve in our projects which works.
-
Monday, May 24, 2010 4:06 AM
with <serviceMetadata httpGetEnabled="true" />
this line and without this line , in both case service says this...
i think its because of adding this feature behaviorConfiguration="SyngrafiiServiceBehaviors"....
=========================================================
Service
This is a Windows© Communication Foundation service.
Metadata publishing for this service is currently disabled.
If you have access to the service, you can enable metadata publishing by completing the following steps to modify your web or application configuration file:
1. Create the following service behavior configuration, or add the <serviceMetadata> element to an existing service behavior configuration:<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors" >
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>2. Add the behavior configuration to the service:
<service name="MyNamespace.MyServiceType" behaviorConfiguration="MyServiceTypeBehaviors" >
Note: the service name must match the configuration name for the service implementation.
3. Add the following endpoint to your service configuration:<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
Note: your service must have an http base address to add this endpoint.
The following is an example service configuration file with metadata publishing enabled:<configuration>
<system.serviceModel>
<services>
<!-- Note: the service name must match the configuration name for the service implementation. -->
<service name="MyNamespace.MyServiceType" behaviorConfiguration="MyServiceTypeBehaviors" >
<!-- Add the following endpoint. -->
<!-- Note: your service must have an http base address to add this endpoint. -->
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors" >
<!-- Add the following element to your service behavior configuration. -->
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>For more information on publishing metadata please see the following documentation: http://go.microsoft.com/fwlink/?LinkId=65455.
-
Wednesday, May 26, 2010 12:32 AM
Please retain the <serviceMetadata httpGetEnabled="true" />
Can you try changing this
<service name="SilverAnnotation.SyngrafiiService" behaviorConfiguration="SampleServiceBehaviors">
<endpoint address="/BasicSoap" binding="basicHttpBinding" bindingConfiguration="LargeBuffer"
name="basicHttpBinding" contract="SilverAnnotation.ISyngrafiiService" />
<!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />-->
</service>
to
<service name="SilverAnnotation.SyngrafiiService" behaviorConfiguration="SampleServiceBehaviors">
<endpoint binding="basicHttpBinding" bindingConfiguration="LargeBuffer"
contract="SilverAnnotation.ISyngrafiiService" />
</service>
-
Wednesday, May 26, 2010 1:01 AM
i have done setting in web.config same but because of that behavior name="SampleServiceBehaviors" >.
why its not taking servicebehaviors name ?
its showing the client reference error--
Metadata contains a reference that cannot be resolved: 'http://localhost:2358/SyngrafiiService.svc'. Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:2358/SyngrafiiService.svc. The client and service bindings may be mismatched. The remote server returned an error: (415) Unsupported Media Type.
-
Wednesday, May 26, 2010 1:07 AM
-
Wednesday, May 26, 2010 9:54 AM
Can you check if this link helps?
http://social.msdn.microsoft.com/forums/en-US/wcf/thread/f29cd9c8-3c89-43d2-92ae-d2a270ab86b9/
-
Thursday, May 27, 2010 8:00 AM
no Clue man ! wt to do ?
-
Thursday, July 29, 2010 5:27 AM
Hi brajeh ...
I have the same error like you !! and i cannot find a solution !!
if you have find the solution , can you tell me what you did please !!!
thanks and best regard

