Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > .NET Framework > Forum > บันทึกรูปใน sql server โดยผ่าน WCF Service ไม่ได้ C# - the remote server returned an unexpected response (413) request entity too large


 

[.NET] บันทึกรูปใน sql server โดยผ่าน WCF Service ไม่ได้ C# - the remote server returned an unexpected response (413) request entity too large

 
Topic : 115531



โพสกระทู้ ( 35 )
บทความ ( 0 )



สถานะออฟไลน์



คือมัน error แบบนี้ครับ

Error
the remote server returned an unexpected response (413) request entity too large


ด

มันบอกว่า file ใหญ่เกีนไป แต่รูบมีแค่ 55.5 KB เองครับ
หาวิธีแก้ในเน็ด 2 วันแล้ว ทำตามเขาก็ไม่ได้ เขาบอกไปแก้ที่ Web.config แก้ตามเขา แต่ก็ไม่ได้ ช่วยแนะนำด้วยครับ

file Web.config อยู่ฝั่ง Service

Code (XML)
01.<?xml version="1.0"?>
02.<configuration>
03.  <system.diagnostics>
04.    <sources>
05.      <source propagateActivity="true" name="System.ServiceModel" switchValue="Warning,ActivityTracing">
06.        <listeners>
07.          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
08.            <filter type="" />
09.          </add>
10.          <add name="ServiceModelTraceListener">
11.            <filter type="" />
12.          </add>
13.        </listeners>
14.      </source>
15.    </sources>
16.    <sharedListeners>
17.      <add initializeData="d:\sharesourcehospital\hospital4\hospitalserver\web_tracelog.svclog"
18.        type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
19.        name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
20.        <filter type="" />
21.      </add>
22.    </sharedListeners>
23.  </system.diagnostics>
24.  <connectionStrings>
25.    <add name="sqlconnect"
26.        connectionString="Data Source=GM-VATH\SQLEXPRESS;Initial Catalog=Hospital;User ID=sa;Password=12345"
27.        providerName="System.Data.SqlClient" />
28.  </connectionStrings>
29.  <appSettings>
30.    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
31.  </appSettings>
32.  <system.web>
33. 
34.    <compilation debug="true" targetFramework="4.5" />
35.    <httpRuntime maxRequestLength="2097151000" targetFramework="4.5"/>
36.  </system.web>
37. 
38. 
39.   
40.  <system.serviceModel>
41.    <behaviors>
42.      <serviceBehaviors>
43.        <behavior>
44.          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
45.          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
46.          <!-- 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 -->
47.          <serviceDebug includeExceptionDetailInFaults="false"/>
48.        </behavior>
49.      </serviceBehaviors>
50.    </behaviors>
51.    <protocolMapping>
52.        <add binding="basicHttpsBinding" scheme="https" />
53.    </protocolMapping>   
54.    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
55.     
56.    <!-- custom insert -->
57.    <bindings>
58.      <basicHttpBinding>
59.        <binding name="wsBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8"
60.     transferMode="Streamed">
61.        <!--<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />-->
62.          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
63.          maxArrayLength="2147483647" maxBytesPerRead="2147483647"
64.          maxNameTableCharCount="2147483647"/>
65.         <security mode="None">
66.      <transport clientCredentialType="None"
67.              proxyCredentialType="None" realm="" />
68.      <message clientCredentialType="UserName" algorithmSuite="Default" />
69.  </security>
70.        </binding>
71.      </basicHttpBinding>
72.    </bindings>
73.  </system.serviceModel>
74.  <system.webServer>
75.    <modules runAllManagedModulesForAllRequests="true"/>
76.    <!--
77.        To browse web app root directory during debugging, set the value below to true.
78.        Set to false before deployment to avoid disclosing web app folder information.
79.      -->
80.    <directoryBrowse enabled="true"/>
81.    
82.  </system.webServer>
83. 
84.</configuration>



App.config ฝั่ง Client ครับ
Code (XML)
01.<?xml version="1.0" encoding="utf-8" ?>
02.<configuration>
03.    <configSections>
04.    </configSections>
05.    <system.diagnostics>
06.        <sources>
07.            <source propagateActivity="true" name="System.ServiceModel" switchValue="Warning,ActivityTracing">
08.                <listeners>
09.                    <add type="System.Diagnostics.DefaultTraceListener" name="Default">
10.                        <filter type="" />
11.                    </add>
12.                    <add name="ServiceModelTraceListener">
13.                        <filter type="" />
14.                    </add>
15.                </listeners>
16.            </source>
17.        </sources>
18.        <sharedListeners>
19.            <add initializeData="d:\sharesourcehospital\hospital4\hospital\app_tracelog.svclog"
20.                type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
21.                name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
22.                <filter type="" />
23.            </add>
24.        </sharedListeners>
25.    </system.diagnostics>
26.    <connectionStrings>
27.        <add name="sqlconnect"
28.            connectionString="Data Source=GM-VATH\SQLEXPRESS;Initial Catalog=Hospital;User ID=sa;Password=12345"
29.            providerName="System.Data.SqlClient" />
30.    </connectionStrings>
31.  <startup useLegacyV2RuntimeActivationPolicy="true">
32.    <supportedRuntime  sku=".NETFramework,Version=v4.0" version="v4.0"/>
33.  </startup>
34.  <system.serviceModel>
35.    <bindings>
36.      <basicHttpBinding>
37.        <binding name="BasicHttpBinding_IHospitalService" closeTimeout="00:11:00"
38.          openTimeout="00:11:00" receiveTimeout="00:11:00" sendTimeout="00:11:00"
39.          maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
40.        <binding name="BasicHttpBinding_IHospitalService1" closeTimeout="00:11:00"
41.          openTimeout="00:11:00" receiveTimeout="00:11:00" sendTimeout="00:11:00"
42.          maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
43.        <binding name="BasicHttpBinding_IService1" closeTimeout="00:11:00"
44.          openTimeout="00:11:00" sendTimeout="00:11:00" maxBufferPoolSize="2147483647"
45.          maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
46.        <binding name="BasicHttpBinding_IService11" closeTimeout="00:11:00"
47.          openTimeout="00:11:00" sendTimeout="00:11:00" maxBufferPoolSize="2147483647"
48.          maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
49.      </basicHttpBinding>
50.    </bindings>
51.    <client>
52.      <!--http://localhost:9682/HospitalService.svc -->
53.      <endpoint address="http://localhost:9682/HospitalService.svc"
54.        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IHospitalService"
55.        contract="HosService.IHospitalService" name="BasicHttpBinding_IHospitalService" />
56.      <endpoint address="http://localhost:9682/Service1.svc" binding="basicHttpBinding"
57.        bindingConfiguration="BasicHttpBinding_IService1" contract="ActionService1.IService1"
58.        name="BasicHttpBinding_IService1" />
59.      <endpoint address="http://localhost:9682/Service1.svc" binding="basicHttpBinding"
60.        bindingConfiguration="BasicHttpBinding_IService11" contract="ActionService.IService1"
61.        name="BasicHttpBinding_IService11" />
62.    </client>
63.  </system.serviceModel>
64.</configuration>




Tag : .NET, Ms SQL Server 2012, C#

Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2015-03-31 14:01:55 By : hacker2015 View : 2123 Reply : 10
 

 

No. 1



โพสกระทู้ ( 74,059 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ถ้าไฟล์เล็ก ๆ ได้หรือเปล่าครับ เช่นซะ 2-4 K ประมาณนี้ครับ ถ้าได้แสดงว่าน่าจะต้องไปหา Config พวก Size อะไรซะอย่างที่เกี่ยวข้องครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-04-01 07:39:35 By : mr.win
 

 

No. 2



โพสกระทู้ ( 35 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 1 เขียนโดย : mr.win เมื่อวันที่ 2015-04-01 07:39:35
รายละเอียดของการตอบ ::
file เล็ก บันทึกได้ครับ
หาทางแก้วันนี้ วันที่สามแล้ว ยังไม่ได้เลย

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-04-01 11:33:53 By : hacker2015
 

 

No. 3



โพสกระทู้ ( 74,059 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Code
<system.serviceModel> <services> <service name="RGB2LEDWebService.RGB2LED"> <endpoint name="http" binding="basicHttpBinding" contract="RGB2LEDWebService.IRGB2LED" /> </service> </services> <bindings> <basicHttpBinding> <binding maxReceivedMessageSize="2147483647" /> </basicHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior> <dataContractSerializer maxItemsInObjectGraph="2147483647" /> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior> <dataContractSerializer maxItemsInObjectGraph="2147483647" /> </behavior> </endpointBehaviors> </behaviors> <protocolMapping> <add binding="basicHttpsBinding" scheme="https" /> </protocolMapping> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> </system.serviceModel>

เท่าที่หาดูก็มีประมาณนี้แหละครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-04-01 12:56:34 By : mr.win
 

 

No. 4



โพสกระทู้ ( 74,059 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

อีกตัวอย่าง

Code
<bindings> <basicHttpBinding> <binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text"> <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> </binding> </basicHttpBinding> </bindings>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-04-01 13:03:57 By : mr.win
 

 

No. 5



โพสกระทู้ ( 35 )
บทความ ( 0 )



สถานะออฟไลน์


ขอบคุณครับ ที่แนะนำ ผมแก้ตามแล้ว แต่ยังไม่ได้ เดี๋ยวผมจะค้นหาต่อไป หวังว่าสักวันมันต้องได้
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-04-01 14:12:16 By : hacker2015
 

 

No. 6



โพสกระทู้ ( 74,059 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ลองดูครับ ถ้าได้ยังไงรบกวนกลับมาบอกวิธีด้วยครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-04-02 09:41:12 By : mr.win
 

 

No. 7



โพสกระทู้ ( 35 )
บทความ ( 0 )



สถานะออฟไลน์


ได้แล้วครับ
5 วันเต็มๆ

ถ้าใคร Error แบบเดียวกันกับผมก็ลองเอาไปปรับดูครับ

SERVICE SIDE
01.<system.serviceModel>
02.    <behaviors>
03.      <serviceBehaviors>
04.        <behavior name="Service.AdMapServiceBehavior">
05.          <serviceMetadata httpGetEnabled="true" />
06.          <serviceDebug includeExceptionDetailInFaults="false" />
07.        </behavior>
08.      </serviceBehaviors>
09.    </behaviors>
10.    <services>
11.      <service behaviorConfiguration="Service.AdMapServiceBehavior"
12.        name="Service.AdMapService">
13.        <endpoint address="" binding="wsHttpBinding" contract="Service.IAdMapService" name="wsHttp" bindingConfiguration="wsHttpBindingConfiguration">
14.          <identity>
15.            <dns value="localhost" />
16.          </identity>
17.        </endpoint>
18.        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
19.      </service>
20.    </services>
21.     
22.    <bindings>
23.      <wsHttpBinding
24.        <binding name="wsHttpBindingConfiguration" maxReceivedMessageSize="65536000" messageEncoding="Text" maxBufferPoolSize="65536000">
25.          <readerQuotas maxArrayLength="65536000" maxBytesPerRead="65536000" maxDepth="65536000" maxStringContentLength="2048576" maxNameTableCharCount="2048576" ></readerQuotas>
26.        </binding>       
27.      </wsHttpBinding>
28.    </bindings>
29.  </system.serviceModel>



CLIENT SIDE
01.<system.serviceModel>
02.        <bindings>
03.   <wsHttpBinding>
04.    <binding name="wsHttpBindingConfiguration" closeTimeout="00:01:00" openTimeout="00:01:00"
05.     receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
06.     transactionFlow="false" hostNameComparisonMode="StrongWildcard"
07.     maxBufferPoolSize="65536000" maxReceivedMessageSize="65536000" messageEncoding="Text"
08.     textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
09.     <readerQuotas maxDepth="65536000" maxStringContentLength="65536000" maxArrayLength="65536000"
10.      maxBytesPerRead="65536000" maxNameTableCharCount="65536000" />
11.     <reliableSession ordered="true" inactivityTimeout="00:10:00"
12.      enabled="false"/>
13.      <!--<security mode="Message">
14.      <transport clientCredentialType="Windows" proxyCredentialType="None"
15.       realm="" />
16.      <message clientCredentialType="Windows" negotiateServiceCredential="true"
17.       algorithmSuite="Default" />
18.     </security>-->
19.    </binding>
20.   </wsHttpBinding>
21.  </bindings>
22.        <client>
23.   <endpoint address="http://localhost:7352/AdMapService.svc" binding="wsHttpBinding"
24.    contract="AdMapServiceReference.IAdMapService"
25.    name="wsHttp" behaviorConfiguration="WSHttpBinding_IAdMapService" bindingConfiguration="wsHttpBindingConfiguration">
26.    <identity>
27.     <dns value="localhost" />
28.    </identity>
29.   </endpoint>
30.  </client>
31. 
32.    <behaviors>
33.      <endpointBehaviors>
34.        <behavior name="WSHttpBinding_IAdMapService">
35.          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
36.        </behavior>
37.      </endpointBehaviors>
38.    </behaviors>
39.    </system.serviceModel>



ประวัติการแก้ไข
2015-04-03 11:49:18
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-04-03 11:47:48 By : keooudone
 

 

No. 8



โพสกระทู้ ( 74,059 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ประเด็นหลักมันอยู่ที่ Set ค่าอะไรครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-04-03 11:56:36 By : mr.win
 

 

No. 9



โพสกระทู้ ( 35 )
บทความ ( 0 )



สถานะออฟไลน์


ผมไม่แน่ใจครับ
เพาะแก้จาก code เดีมผมหลายแถวมาก ผม copy ของเขา มาทับของเดีม แล้วเปลี่ยน endpoint ให้ใช้งานกับ WCF Service ผม
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-04-03 13:28:57 By : keooudone
 

 

No. 10



โพสกระทู้ ( 74,059 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-04-03 13:40:49 By : mr.win
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : บันทึกรูปใน sql server โดยผ่าน WCF Service ไม่ได้ C# - the remote server returned an unexpected response (413) request entity too large
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่