'2009/04'에 해당되는 글 10건

  1. 2009/04/30 Silverlight - Network (2)
  2. 2009/04/28 Silverlight domain access control
  3. 2009/04/23 Memory usage of current thread on C# windows form app.
  4. 2009/04/22 Using WMI to Configure New OCS Users – WMI를 이용한 OCS 사용자 설정
  5. 2009/04/21 Recently released OCS R2 binaries download
  6. 2009/04/20 C# : TextBox Auto Scrolling (2)
  7. 2009/04/14 Better string.IsNullOrEmpty() ? How to do C#.NET 3.0
  8. 2009/04/10 C# - Length unit class , 길이 관련 클래스
  9. 2009/04/09 OCS R2 - SRTP / Protocol List
  10. 2009/04/03 Error Handling Guide - Rethrow to preserve stack details
2009/04/30 10:07

Silverlight - Network


자료 출처 : http://hugeflow.com/


Silverlight network

WebClient vs WebRequest



실버라이트 2.0에는 동기방식의 통신은 없애고 비동기 통신만 남겨두었다.

이 방식을 사용하기에 WebClient와 WebRequest 두가지를 사용할 수 있는데.

WebClient가 약간 더 코드가 간결하고 WebRequest는 어렵다. 하지만 크게 어려운 것은 아니다.

다음의 기본 사용 예로 설명을 대신하도록 한다.


WebClient

 

WebClient wc = new WebClient();

wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);

wc.DownloadStringAsync(new Uri("http://hugeflow.com/sample.xml", UriKind.RelativeOrAbsolute));

void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)

{

        string result = e.Result;

}




HttpWebRequest

 

HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri("http://hugeflow.com/sample.xml", UriKind.Absolute));

request.BeginGetRequestStream(new AsyncCallback(ReadCallback), request);

private void ReadCallback(IAsyncResult asynchronousResult)

{

        HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;

        HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asynchronousResult);

        using (StreamReader reader = new StreamReader(response.GetResponseStream()))

        {

                string result = reader.ReadToEnd();

        }

} 








저작자 표시 비영리 변경 금지
이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License

'.NET > Silverlight' 카테고리의 다른 글

Silverlight - Access HTML document  (0) 2009/05/07
Silverlight - Access managed code form javascript  (0) 2009/05/05
Silverlight - Network  (2) 2009/04/30
Silverlight domain access control  (0) 2009/04/28
REMIX08 RIA, UX의 세계  (0) 2008/06/16
Programming Silverlight with JavaScript  (0) 2008/05/28
올블로그추천버튼 블코추천버튼 블로그뉴스추천버튼 믹시추천버튼 한RSS추가버튼 구글리더기추천버튼


이 포스팅이 도움이 되었다면 구글에서 관련 정보를 찾아 보세요 ^^


Trackback 0 Comment 2

Trackback : http://i-ruru.com/trackback/460 관련글 쓰기

  1. 꼬기얌얌얌 2009/04/30 12:48 address edit & del reply

    혹시 지금 실버라이트트레이닝 청강 중이신건가요...ㅡㅡ?;;;

    • BlogIcon 써니루루 2009/04/30 13:19 address edit & del

      네 실시간이에요.. ㅎㅎ

2009/04/28 12:51

Silverlight domain access control

실버라이트에서는 clientaccesspolicy.xml 파일을 이용해서 사용자 접근을 제어한다.

다음과 같이 예를 보면,

 

http://hugeflow.com/clientaccesspolicy.xml

 

silverlight 호스트 하는 서버의 사용자 접근에 대한 접근제어를 지정한다

 

<?xml version="1.0" encoding="utf-8"?>

<access-policy>

<cross-domain-access>

<policy>

<allow-from>

<domain uri="*"/>

</allow-from>

<grant-to>

<resource path="/" include-subpaths="true"/>

</grant-to>

</policy>

</cross-domain-access>

</access-policy>

 

 

 

 

 

FLEX에서의 접근제어는 crossdomain.xml 파일을 이용한다.

 

http://www.yahoo.com/crossdomain.xml

 

<?xml version="1.0"?>

<!DOCTYPE cross-domain-policy

SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">

<cross-domain-policy>

<allow-access-from domain="*.yahoo.com" secure="false" />

</cross-domain-policy>

저작자 표시 비영리 변경 금지
이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License
올블로그추천버튼 블코추천버튼 블로그뉴스추천버튼 믹시추천버튼 한RSS추가버튼 구글리더기추천버튼


이 포스팅이 도움이 되었다면 구글에서 관련 정보를 찾아 보세요 ^^


Trackback 0 Comment 0

Trackback : http://i-ruru.com/trackback/448 관련글 쓰기

2009/04/23 14:33

Memory usage of current thread on C# windows form app.

 

윈도우 폼을 만들어 실행할 때 현재 프로그램이 메모리를 얼마나 사용하는지,

어떤 동작에 메모리 변화가 어떤지 실시간으로 확인하고 싶은 경우가 많이 있죠.

   

그래서 다음과 같은 코드가 필요할 수 있습니다.

   

먼저 디자이너 코드에는 다음과 같이 Timer Class가 있어야 합니다.

   

private System.Windows.Forms.Timer timer1;

private void InitializeComponent()

{

this.timer1 = new System.Windows.Forms.Timer(this.components);

//

// timer1

//

this.timer1.Enabled = true;

this.timer1.Interval = 3000; // 3초마다 메모리 값을 읽어옵니다.

this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

}

   

위 만들어진 timer1을 이용해 아래와 같이 메모리 양을 구해오는 코드를 Form Text 속성에 할당해 주면 되는 것이죠.

   

#region 현재 쓰래드의 메모리 사용량

private readonly string titleStr = "기본적으로 설정할 타이틀 명칭을 기입합니다";

   

private void timer1_Tick(object sender, EventArgs e)

{

long size = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64;

string sizeStr = GetMemorySize(size);

this.Text = string.Format("{0} - {1}", titleStr, sizeStr);

}

   

enum MemorySizeType

{

Byte, KByte, MByte, GByte, TByte

}

   

private string GetMemorySize(Int64 usageMemory)

{

String retStr = String.Empty;

System.Text.StringBuilder sb = new System.Text.StringBuilder();

   

int i = 0;

   

while (usageMemory > 1024L)

{

usageMemory = (Int64)(usageMemory / 1024L);

i++;

}

   

MemorySizeType sizeType = (MemorySizeType)i;

   

sb.AppendFormat("{0}{1}", usageMemory, sizeType.ToString());

retStr = sb.ToString();

   

return retStr;

}

#endregion

   

벌써 끝이네요…

   

참~ 쉽죠잉~?

저작자 표시 비영리 변경 금지
이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License
올블로그추천버튼 블코추천버튼 블로그뉴스추천버튼 믹시추천버튼 한RSS추가버튼 구글리더기추천버튼


이 포스팅이 도움이 되었다면 구글에서 관련 정보를 찾아 보세요 ^^


Trackback 0 Comment 0

Trackback : http://i-ruru.com/trackback/447 관련글 쓰기

2009/04/22 13:00

Using WMI to Configure New OCS Users – WMI를 이용한 OCS 사용자 설정

OCS에서 사용자 속성을 정해서 사용자 정보를 Active Directory 일괄 입력하고자 , 아래와 같이 WMI 이용하거나 ADDS 관련 COM객체를 이용해야 한다.

다음 내용은 WMI 이용해서 사용자를 설정하고자 알아두어야 속성 값들에 대한 설명을 나타낸다

 

 http://technet.microsoft.com/en-us/library/dd441296(office.13).aspx

 Microsoft Office Communications Server 2007 R2

Using WMI to Configure New Users

Your organization might choose to create your own scripts to enable new users for Office Communications Server instead of using the Active Directory Users and Computers snap-in or the Office Communications Server administrative snap-in. This section identifies the Active Directory attributes that can be set for new users and maps them to their associated WMI properties.

 Working with Active Directory Attributes

Keep the following points in mind when setting Active Directory attributes to enable new users:

  • Active Directory attributes that are not defined map to either FALSE (if Boolean) or NULL in WMI.
  • Some attributes have a bit-mask value. For these attributes, each setting is represented by a bit, and the displayed decimal value represents the bit placement. Each bit represents a WMI property. The following are some examples:
    • 10000 (binary) has a decimal value of 16 (bit 4 is set)
    • 100000000 (binary) has a decimal value of 256 (bit 8 is set)
    • 1100 (binary) has a decimal value of 12 (bits 2 and 3 are set; WMI properties represented by both bits are enabled)
    • 1111000001 (binary) has a decimal value of 961 (bits 0, 6, 7, 8, and 9 are set; WMI properties for each of these bits are enabled)

For more information about Active Directory attributes, see Active Directory Domain Services Attributes and Descriptions.

 Active Directory Attributes to WMI Properties Mapping

Note:

Attributes in bold are required for enabling users for Office Communications Server.

Active Directory Attributes for New Users

Active Directory Attribute

WMI Property

Comments

msRTCSIP-ArchivingEnabled

 

Identifies whether user's communications are archived. Each WMI property is represented by a set bit. Values are:

Bit 2 set

ArchiveInternalCommunications

4 decimal (100 binary)

Bit 3 set

ArchiveFederatedCommunications

8 decimal (1000 binary)

msRTCSIP-FederationEnabled

EnabledForFederation

True/False

msRTCSIP-InternetAccessEnabled

EnabledForInternetAccess

True/False

msRTCSIP-Line

LineURI

The device ID (SIP URI or TEL URI) of the phone the user controls. For example: tel:+142489982. If a user is enabled for Enterprise voice, the E.164 normalized version of the user's phone number.

msRTCSIP-LineServer

LineServerURI

SIP URI of the CSTA-SIP gateway server. For example: sip:pbx@vdomain.com

msRTCSIP-OptionFlags

 

Each option is represented by a set bit. Values are:

Bit 0 set

PublicNetworkEnabled

1 decimal (1 binary)

Bit 4 set

RemoteCallControlTelephonyEnabled

16 decimal (10000 binary)

Bit 6 set

AllowOrganizeMeetingWithAnonymousParticipants

64 decimal (1000000 binary)

Bit 7 set

UCEnabled

128 decimal (10000000 binary)

Bit 8 set

EnabledForEnhancedPresence

256 decimal (100000000 binary)

Bit 9 set

IPPBXSoftPhoneRoutingEnabled

512 decimal (1000000000 binary)

msRTCSIP-PrimaryHomeServer

HomeServerDN

The DN of the pool where user is homed

msRTCSIP-PrimaryUserAddress

PrimaryURI

SIP address of the user

msRTCSIP-UserEnabled

Enabled

True/False

msRTCSIP-UserLocationProfile

LocationProfile

The DN of a location profile object

msRTCSIP-UserPolicy

 

A multi-valued attribute (array) containing a list of DNs of global user policies for the three types of policies. The policy DN is appended to the binary value to indicate the type of policy to which the DN points.

B:8:01000000

MeetingPolicy

B:8:01000000:<DN of meeting policy>

B:8:02000000

UCPolicy

B:8:02000000:<DN of UC policy>

B:8:05000000

PresencePolicy

B:8:05000000:<DN of presence policy>

proxyAddresses

-

When a user is enabled, the user's SIP address should be added to this multi-value attribute. When a user is updated, the SIP address should be updated, and when a user is deleted for Office Communications Server (not deleted in AD DS), the SIP address should be removed.

저작자 표시 비영리 변경 금지
이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License
올블로그추천버튼 블코추천버튼 블로그뉴스추천버튼 믹시추천버튼 한RSS추가버튼 구글리더기추천버튼


이 포스팅이 도움이 되었다면 구글에서 관련 정보를 찾아 보세요 ^^


Trackback 0 Comment 0

Trackback : http://i-ruru.com/trackback/442 관련글 쓰기

2009/04/21 13:13

Recently released OCS R2 binaries download

The OCS 2007 R2 binaries were recently released for public download. The table below is a compiled list of currently available R2 downloads:

최근 OCS 2007 R2 바이너리 를 아래와 같이 다운로드 할 수 있습니다.


Title

Microsoft Office Communications Server 2007 R2 Trial Download

Microsoft Office Communicator 2007 R2 Trial Download

Microsoft Office Communications Server 2007 R2  Attendant

Office Communicator Phone Edition (2007 R2)

Microsoft Office Communicator Mobile 2007 R2 - Pocket PC

Microsoft Office Communicator Mobile 2007 R2 - Smartphone

Microsoft Unified Communications Managed API 2.0 SDK (32 bit)

Microsoft Unified Communications Managed API 2.0 SDK (64-bit)

Microsoft Office Communications Server 2007 R2 UCMA 2.0 Speech Language Packs

Microsoft Office Communications Server 2007 R2 Group Chat server

Microsoft Office Communications Server 2007 R2 Group Chat client

Microsoft Office Communications Server 2007 R2, Group Chat Administration Tool

Conferencing Add-in for Microsoft Office Outlook

Microsoft Office Live Meeting 2007 client

Microsoft Office Communications Server 2007 R2 Group Policy Documentation

Microsoft Office Communications Server 2007 R2 SDK



출처 : http://blogs.technet.com/kpalmvig/archive/2009/03/10/ocs-2007-r2-downloads.aspx
저작자 표시 비영리 변경 금지
이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License
올블로그추천버튼 블코추천버튼 블로그뉴스추천버튼 믹시추천버튼 한RSS추가버튼 구글리더기추천버튼


이 포스팅이 도움이 되었다면 구글에서 관련 정보를 찾아 보세요 ^^


Trackback 0 Comment 0

Trackback : http://i-ruru.com/trackback/446 관련글 쓰기

2009/04/20 15:26

C# : TextBox Auto Scrolling


TextBox의 스크롤을 지정하기 위해 일단 Multiline 모드를 설정하고, Scrollbar가 Vertical로 되어 있다면 더 좋겠죠.


1. 다음과 같이 TextBox에 값을 설정 후

textBox.Text = "some string";

스크롤이 생길 정도의 문자열을 넣어도 스크롤은 위에 고정되어 있습니다.

계속 바닥으로 스크롤이 되어있기 원한다면

textBox.Select(textBox.Text.Length, 0);
textBox.ScrollToCaret();

위와 같은 코드를 값을 입력 후 실행해 줍니다.


2. 문자열 값을 추가하고 항상 scroll을 바닥으로 하고 싶다면.

textBox.Text += "some string";

위와 같은 코드는 피해야 합니다.

textBox.AppendText("some string");

대신 AppendText(string) 메소드를 사용하면 값을 입력한 후 스크롤이 바닥으로 이동합니다.


저작자 표시 비영리 변경 금지
이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License
올블로그추천버튼 블코추천버튼 블로그뉴스추천버튼 믹시추천버튼 한RSS추가버튼 구글리더기추천버튼


이 포스팅이 도움이 되었다면 구글에서 관련 정보를 찾아 보세요 ^^


Trackback 0 Comment 2

Trackback : http://i-ruru.com/trackback/445 관련글 쓰기

  1. 無名 2009/07/30 14:26 address edit & del reply

    갈증을 풀고 갑니다~

    • BlogIcon 써니루루 2009/07/31 14:59 address edit & del

      도움이 되셨다니 다행입니다.
      ^ ^

2009/04/14 13:46

Better string.IsNullOrEmpty() ? How to do C#.NET 3.0




String.IsNullOrEmpty() 더 잘 활용해보자

 

http://blog.yesnobox.com/post/Better-stringIsNullOrEmpty().aspx

우리가 자주 사용하는 string.IsNullOrEmpty()

다들 이 메소드를 사용하면서 익숙해졌겠지만.

아마도 한번쯤 이런생각을 했을지 모른다.


str.ToString() 처럼 object내의 메소드로 만들지 않고 왜 Class의 static 메소드로 만들었을까?

str.IsNullOrEmpty()로 사용하면 편할텐데.. ?



위 주소에 위와 같은 생각을 해결해 줄 수 있다.

저작자 표시 비영리 변경 금지
이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License
올블로그추천버튼 블코추천버튼 블로그뉴스추천버튼 믹시추천버튼 한RSS추가버튼 구글리더기추천버튼


이 포스팅이 도움이 되었다면 구글에서 관련 정보를 찾아 보세요 ^^


Trackback 0 Comment 0

Trackback : http://i-ruru.com/trackback/441 관련글 쓰기

2009/04/10 00:30

C# - Length unit class , 길이 관련 클래스


CodeProject에 올라온 코드를 보던 중 유용한 클래스를 발견했다.

딱 보아도 한눈에 알 수 있는 길이 관련된 클래스
원본 길이 단위의 값을 넣고, 원하는 길위 단위로 값을 읽어오기만하면, 길이를 원하는 형식으로 변경할 수 있다.

꽤 유용하게 써먹을 듯?? 훗~

 

    public class Length

    {

        public enum UNITS{FEET=0,KM,METER,MILES}

        private double meter  = 0;

        private double km     = 0;

        private double ft     = 0;

        private double miles  = 0;

 

        public double Meter

        {

            get

            {

                return this.meter;

            }

            set

            {

                this.meter=value;

                this.km=this.meter/1000;

                this.ft=this.meter*3.2808;

                this.miles=this.meter*6.2e-4;

            }

        }

        public double Km

        {

            get

            {

                return this.km;

            }

            set

            {

                this.km=value;

                this.Meter=this.km*1000;

            }

        }

        public double Ft

        {

            get

            {

                return this.ft;

            }

            set

            {

                this.ft=value;

                this.Meter=this.ft/3.2808;

            }

        }

        public double Miles

        {

            get

            {

                return this.miles;

            }

            set

            {

                this.miles=value;

                this.meter=this.miles/6.2e-4;

            }

        }

    }


저작자 표시 비영리 변경 금지
이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License
올블로그추천버튼 블코추천버튼 블로그뉴스추천버튼 믹시추천버튼 한RSS추가버튼 구글리더기추천버튼


이 포스팅이 도움이 되었다면 구글에서 관련 정보를 찾아 보세요 ^^


Trackback 0 Comment 0

Trackback : http://i-ruru.com/trackback/444 관련글 쓰기

2009/04/09 02:22

OCS R2 - SRTP / Protocol List


SRTP 프로토콜이 무엇인지 궁금해 찾아봤더니 아래 사이트에서 아주 잘 설명이 되어 있더군요.

전화관련된 신호 처리에 이용되는 프로토콜인걸 알아냈습니다.

SRTP :
http://blog.daum.net/nicewoosik/4030056

http://www.voiceportal.co.kr/489



그리고 그 아래의 내용은 Microsoft 한국지사 박지호 과장님이 보내주신 OCS R2 관련된 프로토콜이에요.

원본을 번역해서 부연설명 달아 주셨습니다 ^ ^





오늘은 OCS 2007 R2에서 사용되는 Protocol에 대해서 정리하여 소개 드리려 합니다.

 

일반적으로 OCS 2007 R2 SIP기반이라고 설명합니다.

그 이유는 모든 통신은 SIP Message로 부터 시작되기 때문입니다.

이때 보안을 유지 하기 위해서 클라이언트와는 TLS를 통해 SIP Message를 주고 받고,

서버간에는 MTLS를 통해 SIP Message를 주고 받습니다.

여기서 MTLS는 서로가 TLS를 맺는 다는 뜻의 Mutual TLS의 약자 입니다.

 

일반적인 Text 기반의 통신은 SIP 기반의 Message를 통해 내용을 주고 받지만,

실제 Media Data SRTP를 통해서 주고 받습니다.

예를 들면, OC에서 상대방과 화상을 하려 할 때,

어떠한 사용자와 화상이라는 기능을 사용하겠다고 서버와 통신하는 것은 SIP Message를 통해서 진행이 되고, 실제 화상 기능이 연결되면 화상 Data SRTP를 통해서 서로 주고 받게 됩니다.

 

위의 내용은 간략하게 OCS 2007 R2 Protocol 흐름을 설명 드린 것입니다.

추가적으로 다양한 기능을 위해 몇 가지 Protocol OCS 2007 R2에서 사용되고 있습니다.

 

위의 설명된 Protocol을 포함하여 전반적인 Protocol 내용은 아래의 표를 참조해 주세요!


Protocol

Full Name

사용 용도

특징

SIP

Session Initiation Protocol

- OCS 2007 R2의 기본 통신 Protocol

- IM/상태정보/컨퍼런싱/화상/음성/전화신호 통신에 사용

- IETF standard protocol (RFC 3261)

- 음성/화상/화면 공유 기능에 사용되지만 실제 Media Data는 별도의 Protocol 사용

TLS

Transport Layer Security

- OCS 2007 R2의 클라이언트와의 기본 연결 Setting

- IETF standards track protocol (RFC 5246)

- TCP/IP 상의 보안 Protocol

- SSL 3.0 프로토콜에 기반

MTLS

mutual TLS

- OCS 2007 R2 서버 간의 기본 연결 Setting

- 양방향으로 TLS를 설정

HTTP

Hypertext Transfer Protocol

- Focus 와 Conferencing 서버 간의 통신

- Address Book service

- Group Expansion service

- Device Update service

- Downloading meeting content

- Standard Internet protocol

C3P

Centralized Conference Control Protocol

- OC 2007 R2에서 OCS 2007 R2 Conference 생성 및 관리 명령 통신

- Custom Protocol

- SIP SERVICE / INFO messages 안에 XML 방식으로 전달

- 모든 Conferencing 서버 HTTPS 방식으로 전달

PSOM

Persistent Shared Object Model

- 웹컨퍼런스 컨텐트를 전송하는 통신

- Custom Protocol

 

SRTP

Secure Real-Time Transport Protocol

- 보안이 유지된 미디어 통신 (음성/화상/화상공유)

- IETF standard protocol

- RTP 기반의 protocol

SRTCP

Secure Real-Time Control Protocol

- 음성/화상의 신호 품질을 전달

- IETF standard protocol

- RTP/SRTP에 연계되어 사용

ICE

Internet Connectivity Establishment

- 방화벽 NATs 환경에서의 외부 OC 2007 R2 OCS 2007 R2 간의 음성/화상/화면공유를 연결

- IETF Draft (RFC로 곧 표준화 될 예정)

TURN & STUN

Traversal Using Relay NAT /

Session Traversal Utilities for NAT

- 방화벽 NATs 환경에서 최적의 연결 경로를 설정하여 음성/화상/화면공유를 지원

 

 

저작자 표시 비영리 변경 금지
이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License
올블로그추천버튼 블코추천버튼 블로그뉴스추천버튼 믹시추천버튼 한RSS추가버튼 구글리더기추천버튼


이 포스팅이 도움이 되었다면 구글에서 관련 정보를 찾아 보세요 ^^


Trackback 0 Comment 0

Trackback : http://i-ruru.com/trackback/433 관련글 쓰기

2009/04/03 00:34

Error Handling Guide - Rethrow to preserve stack details



훈스닷넷(Hoons.kr)에 다음과 같이 try - catch 구문에서 throw의 사용에 대해 질문이 올라왔습니다.

글쓴이: 주니
제목: try...catch 에 대해서...
2009-04-02 오후 8:57:59
주소 : http://www.hoons.kr/Board.aspx?Name=QAASPNET&Mode=2&BoardIdx=21940

aspx 페이지에서 biz단 함수를 호출하게 되고 biz단 함수에서는 dbbiz를 호출하게 됩니다.
 
그런 try catch 문을 세 곳 다 걸었습니다.
 
catch문에 에러로그를 남기기위해 에러로그 함수를 불렀다가 throw로 타는 형태로 되어있습니다.
 
제가 개념이 약해서 그런데..제일 마지막 dbbiz 단에서 에러가 나서 catch문을 타면 dbbiz catch만 타게 되는건가요?
 
아니면 다시 돌아오면서 catch문을 다 타게 되는건가요??
 
에러로그 함수 호출은 한곳만 불러야되는데...aspx에 넣어야할지..다 넣어야할지가 ㅡ.ㅡ;;;;;




이에 대한 저의 답변

에러 로그 함수는 aspx에서만 하시고요. Exception에 대해서 e로 받으셨다면 e.StackTrace 값을 찍어보시면 어디에서 부터 catch 되어 넘어왔는지 알 수 있습니다.

단, biz와 dbbiz에서 throw는 e를 던지는
throw e 구문은 StackTrace를 타지 않고, 해당 부분부터 다시 StackTrace를 시작하므로 나중에 어디서 에러가 났는지 찾기 힘들어집니다.
throw e; 형식보다 throw 형식으로만 던지도록 작성하세요.

참고하실 주소 : http://msdn.microsoft.com/ko-kr/library/ms182363.aspx



자세한 내용은 다음과 같이 MSDN의 설명이 있습니다.







참고하실 주소 : http://msdn.microsoft.com/ko-kr/library/ms182363.aspx

TypeName

RethrowToPreserveStackDetails

CheckId

CA2200

Category

Microsoft.Usage

Breaking Change

Non Breaking (주요 변경 아님)

 

 

원인(Cause)

예외가 다시 throw되며 예외가 throw 문에 명시적으로 지정되어 있습니다.
An exception is re-thrown and the exception is explicitly specified in the throw statement.

 

규칙 설명 (Rule Description)

예외가 throw된 경우 예외가 제공하는 정보에는 스택 추적 정보가 포함되어 있습니다. 스택 추적은 예외를 throw한 메서드로 시작되어 예외를 catch한 메서드로 끝나는 메서드 호출 계층 구조 목록입니다. throw 문에 예외를 지정하여 예외가 다시 throw되면 현재 메서드에서 스택 추적이 다시 시작되고 예외를 throw한 원래 메서드와 현재 메서드 간의 메서드 호출 목록이 손실됩니다. 원래의 스택 추적 정보를 예외와 함께 유지하려면 예외를 지정하지 않고 throw 문을 사용합니다.
Once an exception is thrown, part of the information it carries is the stack trace. The stack trace is a list of the method call hierarchy that starts with the method that throws the exception and ends with the method that catches the exception. If an exception is re-thrown by specifying the exception in the throw statement, the stack trace is restarted at the current method and the list of method calls between the original method that threw the exception and the current method is lost. To keep the original stack trace information with the exception, use the throw statement without specifying the exception.

 

위반 문제를 해결하는 방법 (How to Fix Violations)

이 규칙 위반 문제를 해결하려면 예외를 명시적으로 지정하지 않고 예외를 다시 throw합니다.
To fix a violation of this rule, re-throw the exception without specifying the exception explicitly.

 

예제(Example)

다음 예제에서는 이 규칙을 위반하는 CatchAndRethrowExplicitly 메서드와 규칙을 충족하는 CatchAndRethrowImplicitly 메서드를 보여 줍니다.
The following example shows a method, CatchAndRethrowExplicitly, which violates the rule and a method, CatchAndRethrowImplicitly, which satisfies the rule.

using System;

 

namespace UsageLibrary

{

class TestsRethrow

{

static void Main()

{

TestsRethrow testRethrow = new TestsRethrow();

testRethrow.CatchException();

}

 

void CatchException()

{

try

{

CatchAndRethrowExplicitly();

}

catch(ArithmeticException e)

{

Console.WriteLine("Explicitly specified:{0}{1}",

Environment.NewLine, e.StackTrace);

}

 

try

{

CatchAndRethrowImplicitly();

}

catch(ArithmeticException e)

{

Console.WriteLine("{0}Implicitly specified:{0}{1}",

Environment.NewLine, e.StackTrace);

}

}

 

void CatchAndRethrowExplicitly()

{

try

{

ThrowException();

}

catch(ArithmeticException e)

{

// Violates the rule.

throw e;

}

}

 

void CatchAndRethrowImplicitly()

{

try

{

ThrowException();

}

catch(ArithmeticException e)

{

// Satisfies the rule.

throw;

}

}

 

void ThrowException()

{

throw new ArithmeticException("illegal expression");

}

}

}


너무 무차별적으로 해설이 없이 소스만 있지만 -_ -;; 이해해주시길..
천천히 분석해볼만 할거에요;;
저작자 표시 비영리 변경 금지
이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License
올블로그추천버튼 블코추천버튼 블로그뉴스추천버튼 믹시추천버튼 한RSS추가버튼 구글리더기추천버튼


이 포스팅이 도움이 되었다면 구글에서 관련 정보를 찾아 보세요 ^^


Trackback 0 Comment 0

Trackback : http://i-ruru.com/trackback/443 관련글 쓰기