2013年4月17日 星期三
{C#} .Net FileUpload 上傳檔案大小超過預設
當上傳檔案後,出現「Maximum Request Length Exceeded」
是因為上傳的檔案超過預設大小
預設為4096>>4MB
異動如下:
<system.web>
<httpRuntime maxRequestLength="10240" />
</system.web>
參考資訊
http://www.dotblogs.com.tw/hatelove/archive/2010/01/14/fileuploadmaxrequestlengthtocustomerrorpage.aspx
2012年8月16日 星期四
{WinServer} WinServer2008 讀取Excel時相關設定
Excel放置Server端後,在Server 端開啟Excel檔案不斷產生「無法存取檔案」「拒絕存取路徑」檢查方式:
1.Server端資料夾權限
2.Server端是否有灌Excel(如是使用Excel Reader元件)
3.config是否有設定 .
<identity impersonate="true" userName="Userid" password="Password" />
參考資料: http://tsaiyuchi.blogspot.tw/2011/02/excel-manipulate.html#more
4.是否有建立C://win...../Desktop資料夾
參考資料:http://tsaiyuchi.blogspot.tw/2011/02/winserver2008-iis-manipulate-excel.html
補充參考資料:
http://www.dotblogs.com.tw/shadow/archive/2011/05/02/24043.aspx
2012年6月13日 星期三
{C#} 回傳字串資料字數爆表(擴大MaxStringContentLength)
當一需要Return字串(或從資料庫撈大量字串資料回來)造成錯誤,擴大web.config MaxStringContentLength值方式--紅字處預設為8192:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="abc" closeTimeout="00:01:00">
<readerQuotas maxDepth="32" maxStringContentLength="1000000" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="abcd" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
參考資料:
http://social.msdn.microsoft.com/Forums/is/wcf/thread/cab9a5f9-7d2e-4b64-8338-8158b2f2b332
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="abc" closeTimeout="00:01:00">
<readerQuotas maxDepth="32" maxStringContentLength="1000000" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="abcd" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
參考資料:
http://social.msdn.microsoft.com/Forums/is/wcf/thread/cab9a5f9-7d2e-4b64-8338-8158b2f2b332
2012年4月25日 星期三
{C#} maxItemsInObjectGraph 設定
設定 maxItemsInObjectGraph 值,預設值為:65536
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="abc">
<dataContractSerializer maxItemsInObjectGraph="6553600" />
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="xxx.asmx behaviorConfiguration="abc" />
</client>
</system.serviceModel>
2012年2月23日 星期四
{C#-SQL資料庫}程式運用web config 與 app config
web 寫法 in C#:
System.Web.Configuration.WebConfigurationManager.ConnectionStrings["ABC"].
ConnectionString;
app寫法 in C#:
System.Configuration.ConfigurationManager.ConnectionStrings["ABC"].ToString();
System.Web.Configuration.WebConfigurationManager.ConnectionStrings["ABC"].
ConnectionString;
app寫法 in C#:
System.Configuration.ConfigurationManager.ConnectionStrings["ABC"].ToString();
訂閱:
文章 (Atom)