기본 콘텐츠로 건너뛰기

6월, 2024의 게시물 표시

[C#] HTTPS로 접속하기

대기업 대상으로 프로그램 개발(SI)을 하고 있는데 예전에는 프로그램 기능에 대해서만 검수를 했었는데 요즘은 프로그램 보안에 대한 요구도 추가로 하고 있습니다. 이와 같이 보안이 강화됨에 따라 기존에 HTTP 프로토콜로 접속 가능하던 사이트들도 HTTPS로 바꾸고 있습니다. 따라서 웹 서비스에 접속하는 클라이언트도 HTTP, HTTPS 둘 다 지원해야 합니다. 아래 코드는 설정에서 접속할 URL을 읽어와 EndpointAddress를 생성합니다. BaseAddress = CommonLib.Common.GetConfigString("BaseClientAddress", "URL", ""); EndPoint = new EndpointAddress(string.Format("{0}/Service.svc", BaseAddress)); EndPoint Scheme으로 접속해야 할 프로토콜을 확인할 수 있습니다. 접속 프로토콜에 따라 바인딩을 생성하면 됩니다. 아래는 CustomBinding 예제 클래스입니다. public class CustomHttpBinding : CustomBinding { private readonly bool useHttps; private readonly bool useBinaryEncoding; private readonly bool useCompression; private readonly HttpTransportBindingElement transport; public CustomHttpBinding(bool useHttps, bool binaryEncoding = true, bool compressMessages = false) { this.useHttps = useHttps; transport = useHttps ? new HttpsTransport

[EYESHOT] BlockReference의 Attribute를 Text로 생성

두 도면 비교를 쉽게 하기 위해 BlockReference를 Explode 시키기로 했습니다. Attribute를 제외한 다른 항목들은 Expolode한 결과를 그대로 사용하면 되는데 Attribute는 Explode한 결과가 Explode하기 전과 달랐습니다. 이를 해결하기 위해 여러 방법을 시도해 봤는데 그 결과가 만족스럽지 못했습니다. Explode한 Attribute의 수가 화면에 보이는(Explode하기 전의) 수와 다를 경우도 있고, Attribute의 TAG를 찾지 못하는 경우도 있었습니다. 여러 방법을 시도하는 중 가장 합리적인 방법을 찾았습니다. 아래는 Attribute에 대응하는 Text를 생성하는 방법입니다. var attributes = blkref.Attributes.Where(x => x.Value.Visible).ToList(); foreach(var attr in attributes) { var pt = attr.Value.InsertionPoint.Clone() as devDept.Geometry.Point3D; var plane = attr.Value.Plane.Clone() as devDept.Geometry.Plane; string TextString = attr.Value.Value; #region 특수 문자 처리 TextString = TextString.Replace("%%", string.Empty); #endregion var txt = new Text(plane, pt, TextString, attr.Value.Height) { LayerName = LayerName, Color = color != Color.Empty ? color : GetAttributeColor(Layers, GetEntColor(Layers, blkref), attr.Value) ColorMethod =

VirtualBox 업데이트

기존 사용하고 있던 VirtualBox 7.0.10-158379에서 7.0.18-162988으로 업데이트를 하고 나서 실행하니 아래와 같은 오류가 발생했습니다. ntcreatefile(\\device\\vboxdrvstub) failed: 0xc0000034 이 오류는 아래 방식으로 해결할 수 있습니다. 기존 VirtualBox를 삭제하고 컴퓨터를 재부팅합니다. C:\Windows\System32\drivers\에서 남아 있는 VBox*.sys 파일을 삭제합니다. 다시 컴퓨터를 재부팅합니다. 관리자 권한으로 VirtualBox를 설치합니다.