TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ritesh Gupta
NA
28
1.7k
Uploading image on server in windows phone7
Apr 2 2013 9:36 AM
I want to upload image to server using WCF service,but i am unable to do it.I am converting to array of byte
Here is my code-
Uri uri = new Uri("http://localhost/WCF_JSONService/Service1.svc/saverecord3" + convertImageToArray(bitmapImage1), UriKind.Absolute);
WebClient wc = new WebClient();
wc.AllowReadStreamBuffering = true;
wc.AllowWriteStreamBuffering = true;
wc.OpenWriteCompleted += new OpenWriteCompletedEventHandler(wc_OpenWriteCompleted);
wc.OpenWriteAsync(uri,"POST");
wc.WriteStreamClosed += new WriteStreamClosedEventHandler(wc_WriteStreamClosed);
void wc_WriteStreamClosed(object sender, WriteStreamClosedEventArgs e)
{
//throw new NotImplementedException();
}
void wc_OpenWriteCompleted(object sender, OpenWriteCompletedEventArgs e)
{
//throw new NotImplementedException();
}
This is server side interface-
[OperationContract]
[WebInvoke(UriTemplate="/saverecord3",Method ="POST",ResponseFormat=WebMessageFormat.Json)]
string saveRecord3(byte[] image1);
Below is Webconfig-
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<diagnostics >
<messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true"/>
</diagnostics>
<bindings>
<webHttpBinding>
<binding name ="webHttpBinding_one" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" receiveTimeout="01:00:00" openTimeout="01:00:00" closeTimeout="01:00:00" sendTimeout="01:00:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</webHttpBinding>
<basicHttpBinding >
<binding name="wsWithMTOM" maxReceivedMessageSize="2147483647" messageEncoding="Mtom">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="servicebehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="restbehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="WCF_JSONService.Service1" behaviorConfiguration="servicebehavior">
<endpoint name="RESTEndPoint" contract="WCF_JSONService.IService1" binding="webHttpBinding" address="" bindingConfiguration="webHttpBinding_one" behaviorConfiguration="restbehavior" />
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
What is wrong with it,please reply me.My email id is
[email protected]
Reply
Answers (
0
)
How to add references in c#???
Implement Image Customization