Thứ Năm, 8 tháng 12, 2016

[Cpanel] Unexpected condition from IMAP server, closed or corrupt connection to IMAP. Possible mailbox corruption.

Đối với lỗi "Unexpected condition from IMAP server, closed or corrupt connection to IMAP. Possible mailbox corruption." khi sử dụng IMAP hoặc Webmail, các bạn ssh và cd vào thư muc mail của hosting

cd /home/user/mail/domain
Eg: cd /home/a406/mail/atwo.com.vn
và chay lệnh rename file dovecot.index thành dovecot.index.backup
find . -type f -name 'dovecot.index' -execdir mv {} {}_backup ';'


Một số trường hợp user không có dovecot.index mà có dovecot.index.cache nên sửa lại lệnh như bên dưới 
find . -type f -name 'dovecot.index.cache' -execdir mv {} {}_backup ';'

Thứ Tư, 7 tháng 12, 2016

[ASP.NET] The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

Server Error in '/' Application. 

Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. 


 => Lỗi này liên quan tới kết nối database quá nhiều. Max Pool Size trong connection string mặc định là 100, có thể set cao hơn để theo dõi. Tuy nhiên khuyến cáo kiểm tra code đóng mở kêt nối .


Server=myAddress:myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword; Max Pool Size=100;Min Pool Size=10;

https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(v=vs.110).aspx

Thứ Năm, 1 tháng 12, 2016

[MSSQL] List Database (expand databse) in SSMS Slow

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/99bbcb47-d4b5-4ec0-9e91-b1a23a655844/ssms-2012-extremely-slow-expanding-databases?forum=sqltools

lý do có nhiều database đang set auto_close = on 
=> xử lý là set thuộc tính database  auto_close = off

SELECT 'Alter Database [' +name+'] set AUTO_CLOSE OFF'
FROM master.sys.databases AS dtb 
WHERE is_auto_close_on = 1
ORDER BY name

=> copy lệnh run trên query mới

Used this script to find those databases: 
SELECT name, is_auto_close_on, is_auto_shrink_on FROM master.sys.databases AS dtb 
WHERE is_auto_close_on = 1 OR is_auto_shrink_on = 1
ORDER BY name

giải thích thuộc tính  auto_close

 According to Books Online:
When set to ON, the database is shut down cleanly and its resources are freed after the last user exits. The database automatically reopens when a user tries to use the database again.

    When set to OFF, the database remains open after the last user exits

AjaxToolkit IIS7 Asp.Net 4.0 - Sys is not defined - scriptsource.axd

<handlers>
    <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <add name="ISAPI-4.0" path="*.axd" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
      <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add name="PricelistHandler" verb="*" path="pricelist.csv" preCondition="integratedMode" type="NopSolutions.NopCommerce.BusinessLogic.ExportImport.PricelistHandler, Nop.BusinessLogic" />
</handlers>

Cần "ScriptResource.axd" va "*.axd"

Tham khao :
http://stackoverflow.com/questions/3822733/ajaxtoolkit-iis7-asp-net-4-0-sys-is-not-defined-handler-mapping-issue

[ASP.NET] 405 - HTTP verb used to access this page is not allowed

Liên quan tới PUT method

disable webdav nếu có

 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
            <remove name="WebDAVModule" />
        </modules>
....
<handlers>
            <remove name="WebDAV" />

đồng thời add thêm PUT method vào

<handlers>
        <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>

https://support.pavietnam.vn/index.php?pa=showitem&pid=1343623

https://support.pavietnam.vn/index.php?pa=showitem&pid=1373822

Thứ Hai, 21 tháng 11, 2016

[OpenSource] Error Report _ Display Error NukeViet

Hiển thị chi tiết lỗi khi bị các lỗi liên quan đến PHP.

Trong quá trình lập trình thao tác với CSDL, nếu có lỗi, hệ thống sẽ không hiển thị thông báo lỗi mà hiển thị nền trang trắng.
Hướng dẫn dưới đây giúp hiển thị thông báo lỗi của php, khi có sự cố xảy ra.


Mở includes/mainfile.php
Tìm và xóa (hoặc comment) những đoạn code

  error_reporting(0);
 
và....

$ErrorHandler = new NukeViet\Core\Error($global_config);
set_error_handler(array(
    &$ErrorHandler,
    'error_handler'
));
 
 
 
***NukeViet 3.0, file mainfile.php home directory

Comment 2 dong
$ErrorHandler = new Error( $global_config );
set_error_handler( array( &$ErrorHandler, 'error_handler' ) );

Thứ Tư, 9 tháng 11, 2016

[ASP.NET] MVC 2 Error : The type or namespace name 'Mvc' does not exist in the namespace 'System.Web'

lỗi :
Compiler Error Message: CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

Source Error:

Line 57: <add namespace="System.Web.Mvc" />
Line 58: <add namespace="System.Web.Mvc.Ajax" />
Line 59: <add namespace="System.Web.Mvc.Html" />
Line 60: <add namespace="System.Web.Routing" />
Line 61: <add namespace="System.Linq" />


Web đang chạy trên server cũ khi move qua server mới thì bị lỗi mặc dù cả 2 server đều setup đầy đủ MVC giống nhau. Nguyên do là server mới update bản vá security của window nên path của 1 số assemble thay đổi, code website khi build không set reference copy local=true thì 1 số trường hợp sẽ lỗi.

cách fix là thêm khai báo assembly trong web.config của site

<assemblies>
<add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
 </assemblies>
...
</system.web>

[PLESK] Plesk 12 Microsoft FTP Service : 530 User cannot log in, home directory inaccessible.

Cho repair : %plesk_cli%\plesk repair ftp -y
https://kb.plesk.com/en/549 

Kiểm tra computer name khớp với user security

[SSL] Hướng dẫn chung, tổng hợp link


- SSL Renew phải sinh lại CSR : vì cert cấp có thời hạn expired, cần xin cert mới

 
link quản lý đơn hàng của hãng GeoTrust và RapidSSL

Hướng dẫn sinh CSR RapidSSL

[LiteSpeed][Cpanel] Các lỗi thường gặp khi switch to LiteSpeed như 500, 503


LightSpeed Hosting Cpanel
Các lỗi thường gặp khi switch to LiteSpeed như 500, 503 thường là do

1, .htaccess, cấu hình rule trong này ko chuẩn
2, suhosin, modsecurity,
3, xung đột giữa các loại cache như apc cache, Opcache, Memcached, accelerator…

Nếu ko phải 3 nguyên nhân trên thì cần debug step by step theo wiki của LiteSpeed

[LiteSpeed] DirectAdmin website báo 404 notfound


- Buil lại apache trên directadmin
- Kiểm tra file cấu /usr/local/lsws/conf/httpd_config.xml
<user>apache</user>
<group>apache</group>