Thứ Tư, 25 tháng 9, 2019

[MDaemon]Đồng bộ User từ Active Directory qua Email Server Mdaemon

Trên máy chủ Mdeamon chúng ta làm những thao tác sau:

1. Accounts -> account settings -> active directory-> monitoring: 
– tick check box: monitor active directory for user
– tick check box: use active directory domain names (nhập domain : tencongty)
2. Accounts -> account settings -> active directory-> options : 
– base entry DN: LDAP://server ip/OU=tenou,DC=tencongty,DC=com.
– bind DN: administrator (user administrator cua ad)
– password: pass admin ad
3. Accounts -> account settings -> active directory-> monitoring: click perform full AD scan now.

Khi bạn kết thúc, click perform full AD scan now thì trong tab system sẽ hiển thị quá trình nhận user của MDaemon từ AD.
Khi đã nhận xong user ta có thể kiểm tra trong phần Accounts-> accounts manager.
Thời gian đồng bộ giữa server MDaemon và AD được thiết lập trong phần : Accounts setting ->Active directory -> Query Active directory for new data every.

Chúc bạn thành công

Thứ Hai, 10 tháng 6, 2019

[ASP][IIS] - Blocked a frame with origin from accessing a cross-origin frame.

Blocked a frame with origin "http://hcmier.edu.vn" from accessing a cross-origin frame. 

Thường bị khi xài ckeditor. Lỗi này xảy ra khi truy cập trang admin có www mà khi mở ckeditor lại không có www.

VD: link admin là : http://www.hcmier.edu.vn/vn/wcms/UserLogin.asp
khi mở ckeditor thì chạy sang link http://hcmier.edu.vn thì sẽ lỗi


==> Cần login vào theo link không www  : http://hcmier.edu.vn/vn/wcms/UserLogin.asp

27U6374938 

Thứ Bảy, 20 tháng 4, 2019

[ASP.NET] Exception of type 'System.OutOfMemoryException' was thrown khi load dữ liệu từ database

Lỗi do giới hạn bởi object trong .NET hoặc do sử dụng Entity Framework. Khi xử lý khối dữ liệu lớn đối tượng chiếm vượt quá bộ nhớ giới hạn có thể xử lý thì sẽ xuất hiện lỗi trên

The limitation of an object in .NET is 2GB, arrays can be bigger on 64bit machines but an EF context cannot be bigger than 2GB. And when using an EF context continuously the memory usage may increase rapidly until the limit is reached. To free memory it is therefore best to renew the context after a while when inserting many rows of data. So the limit is on .NET, not on EF as I mistakenly said before.

Từng gặp với NopCommercial :

https://www.nopcommerce.com/boards/t/52370/nopcommerce-4-systemoutofmemoryexception.aspx

https://stackoverflow.com/questions/45833276/system-outofmemoryexception-on-savechange-in-c-sharp-using-nopcommerce

[ASP.NET] SQL : The wait operation timed out

Do query thực thi quá lâu, mặc định timeout là 30s. Trường hợp này có thể set tăng timeout trong code thực thi query.

In your code where you run the stored procedure you should have something like this:

SqlCommand c = new SqlCommand(...)
//...
Add such a line of code:

c.CommandTimeout = 0;
This will wait as much time as needed for the operation to complete.

đây là 1 ví dụ về set timoute exute query
Trên vd đang set 0 là không limit , Bạn có thể set 60 hoặc 120 chẳng hạn

[WINDOWS] - Window 2012 - 2016 stuck at RDP - Please wait for the local session manager

I would like to report a huge bug in Windows Server 2012 and 2016. For 2012 I need to try multiple times to log in to system using RDP but for upgrading 2012 to 2016 I can't log in at all. Everything is described here:
Basically during RDP logging in process lsass.exe process is parsing ALL local users which takes too much time and incoming RDP session is being disconnected. As far as I can see in Windows Event log about 800-900 local users are being parsed before disconnection occurs.
During logging in process lsass.exe is using large amount of CPU but this is probably realted to checking registry:
As you can see in ProcessManager from time when RDP connection was made 21% of ALL Windows events logged in Process Manager was from lsass.exe process.
There is a easy way to replicate this issue:
I can replicate this bug
1) RDP to a newly created Windows Server
2) create a batch file with the following content:
:start
net user /add user%random%_%random% /random
timeout 1
goto start
open command prompt and execute the batch file.
Wait 20 minutes
try to RDP or connect via console. It won't work.
(and as far as I know it was replicated on MS side but for now nothing is being done or decided what to do with this problem).
Solution for this issue can be just extending RDP timeout which will work just fine because lsass.exe is using more CPU only during local users traversing and after logging in it just drops.
Any ideas/suggestions? Except "just use AD" ok? This specific scenario is on system which holds shared hosting accounts and local users are being used just for keeping website separated from each other and I really don't need AD for this one.


Solution from MS:
We found that each iteration (happening in LogonUI ) makes a call out to LSASS.exe which performs the UserLookup and returns the SID information. This is what it is taking time.

This kind of extensive lookup happens because of new functions introduced from Win2012 onwards.

To turn this lookup off, please add the following registry key ( both the locations ), reboot the machine and then test and let me know the results.

Location 1: HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System
Location 2: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

Key: DontDisplayLastUserName
Type: DWORD
Value: 1

[ASP.NET] Lỗi liên quan SQL CLR , khi move DB qua server mới web không chạy

An error occurred in the Microsoft .NET Framework while trying to load assembly id 65536. The server may be running out of resources, or the assembly may not be trusted. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error:
System.IO.FileLoadException: Could not load file or assembly 'groupconcat, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An error relating to security occurred. (Exception from HRESULT: 0x8013150A

loging in with sa, restoring DB again and setting TRUSTWORTHY ON

USE [apel_vn_db];
EXEC sp_configure 'clr enabled' ,1
GO

USE [apel_vn_db];
GO

EXEC sp_changedbowner 'sa'
USE [apel_vn_db];
GO

ALTER DATABASE [apel_vn_db] SET TRUSTWORTHY ON;

Thứ Bảy, 16 tháng 2, 2019

[CPANEL] Email gửi từ outlook sử dụng port 25 không được

Kiểm tra telnet port 25 tới server nếu kết nối thành công nhưng không phản hồi kết quả liền mà phải đợi 1 lúc (tầm 20s) mới có kết quả trả về thì do cơ chế chặn spam mail. Outlook hết thời gian timeout không nhận được phản hồi từ server

=> Vào WHM -> Exim Configuration -> Introduce a delay into the SMTP transaction for unknown hosts and messages detected as spam. -> set Off -> Restart Exim

Thứ Hai, 7 tháng 1, 2019

[ASP.NET][DevExpress] Exception Details: System.NotSupportedException: Collection is read-only.

Code sử dụng devexpress, chức năng upload file ảnh bị lỗi, có thông tin log error như sau
Exception Details: System.NotSupportedException: Collection is read-only.

=> Vào ISAPI Filter của site trên IIS remove 2 khai báo liên quan helicon rewrite

[ASP.NET][IIS] HttpException (0x80004005): This server variable cannot be modified during request execution

Mô tả, trang admin đăng nhập báo lỗi [HttpException (0x80004005): This server variable cannot be modified during request execution.]

Sử dụng 2 trang, trang admin (đăng nhập) gọi qua 1 trang api (web service) để chứng thực và xảy ra lỗi trên.

Nguyên nhân là do xung đột SF_NOTIFY_AUTHENTICATION event của ISAP Filter và Application_BeginRequest event trong file global.asax của source code.
(https://support.microsoft.com/en-ca/help/2605401/a-system-web-httpexception-occurs-in-internet-information-services-7-0)

=> xử lý 1 trong các cách sau

1. Site site sang pool classsic (nếu Site code tương thích)

2. phải thay đổi code

3. Site bắt buộc chạy pool integrated thì có thể remove các khai báo trong mục ISAP Filter của Site trên IIS