パラメータが有効ではありませんというエラーが表示されます。この問題を解決するにはどうすればよいですか?
次のコードはサーバー側です
MemoryStream ms = new MemoryStream(ObjDt.ImgUpload);
ms.Write(ObjDt.ImgUpload, 0, ObjDt.ImgUpload.Length);
System.Drawing.Image image = System.Drawing.Image.FromStream(ms, true);
image.Dispose();
image.Save(@"D:\Projects\WCF\WCF_ImageUpload\DamagedImages\" + strRandNo + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
// image.Save(@"C:\DotNet\ImageUpload\DamagedImages\" + strRandNo + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
//return strRandNo.ToString();
string val = strRandNo.ToString();
IPAddress = "localhost:53865/WCF/Image" + val + ".jpg";
これらのコードでは、パラメーターが無効なエラーを取得しています..これらのコードのWeb構成は
<bindings>
<basicHttpBinding>
<binding name="StreamedBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed">
<readerQuotas maxDepth="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="Service" behaviorConfiguration="ServiceBehavior">
<!-- <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicBinding1" contract="WCF_ImageUpload.IService1"></endpoint>-->
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="StreamedBinding" bindingName="ServiceBehavior"
contract="WCF_ImageUpload.IService1" />
</service>
</services>
Windows アプリケーションで次のクライアント アプリケーションを使用しています。
Uri uri = new Uri("http://localhost:53865/Service1.svc/UploadDamagedImage");
Details ObjDt = new Details();
ObjDt.Name = "hi";
ObjDt.Email = "hi@gmail.com";
ObjDt.ContactNumber = "3698754215";
ObjDt.DeviceModel = "E23";
ObjDt.Problem = "Repair";
ObjDt.Besttimetocontact = "9am";
byte[] bytes = File.ReadAllBytes("D:/WCFImages/admin.png");
ObjDt.ImgUpload = bytes;
DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(Details));
// xmlserializer xser = new xmlserializer();
MemoryStream mem = new MemoryStream();
ser.WriteObject(mem, ObjDt);
string data = Encoding.UTF8.GetString(mem.ToArray(), 0, (int)mem.Length);
WebClient webClient = new WebClient();
webClient.UploadStringCompleted += new UploadStringCompletedEventHandler(webClient_UploadStringCompleted);
webClient.Headers["Content-type"] = "application/json";
webClient.Encoding = Encoding.UTF8;
webClient.UploadStringAsync(uri, "POST", data);