성태의 닷넷 이야기
홈 주인
모아 놓은 자료
프로그래밍
질문/답변
사용자 관리
사용자
메뉴
아티클
외부 아티클
유용한 코드
온라인 기능
MathJax 입력기
최근 덧글
[정성태] Working with Rust Libraries from C#...
[정성태] Detecting blocking calls using asyn...
[정성태] 아쉽게도, 커뮤니티는 아니고 개인 블로그입니다. ^^
[정성태] 질문이 잘 이해가 안 됩니다. 우선, 해당 소스코드에서 ILis...
[양승조
] var대신 dinamic으로 선언해서 해결은 했습니다. 맞는 해...
[양승조
] 또 막혔습니다. ㅠㅠ var list = props[i].Ge...
[양승조
] 아. 감사합니다. 어제는 안됐던것 같은데....정신을 차려야겠네...
[정성태] "props[i].GetValue(props[i])" 코드에서 ...
[정성태] 저렇게 조각 코드 말고, 실제로 재현이 되는 예제 프로젝트를 압...
[정성태] Modules 창(Ctrl+Shift+U)을 띄워서, 해당 Op...
글쓰기
제목
이름
암호
전자우편
HTML
홈페이지
유형
제니퍼 .NET
닷넷
COM 개체 관련
스크립트
VC++
VS.NET IDE
Windows
Team Foundation Server
디버깅 기술
오류 유형
개발 환경 구성
웹
기타
Linux
Java
DDK
Math
Phone
Graphics
사물인터넷
부모글 보이기/감추기
내용
<div style='display: inline'> <div style='font-family: 맑은 고딕, Consolas; font-size: 20pt; color: #006699; text-align: center; font-weight: bold'>같은 컴퓨터에서만 WCF 요청을 서비스하도록 설정</div><br /> <br /> 이런 경우가 있죠? 보안상. 단지 한 대의 PC 내부에서만 프로세스끼리 통신해야 할 경우라면 굳이 외부로부터 오는 원격 메서드 호출을 허용해야 할 필요가 없습니다.<br /> <br /> 이에 대한 해결책을 아래의 글에서 설명해 주고 있습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; width: 800px; background-color: #fbedbb; overflow-x: scroll; font-family: Consolas, Verdana;' > Securing WCF to only respond to local requests ; <a target='_tab' href='http://blogs.msdn.com/phenning/archive/2006/10/31/securing-wcf-to-only-respond-to-local-requests.aspx'>http://blogs.msdn.com/phenning/archive/2006/10/31/securing-wcf-to-only-respond-to-local-requests.aspx</a> </pre> <br /> 오호... 언제나 Default 값으로만 놓고 사용했던 HostNameComparisonMode 값이 여기서 빛을 발하는군요. ^^<br /> <br /> config에서 설정해주는 것도 물론 가능합니다. 서버 측은 다음과 같이 설정해 주고,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; width: 800px; background-color: #fbedbb; overflow-x: scroll; font-family: Consolas, Verdana;' > <services> <service name="TestWCF.TestService" behaviorConfiguration="TestServiceBehavior"> <host> <baseAddresses> <add baseAddress="<b style='COLOR: blue'>http://127.0.0.1:20000</b>/TestService/"/> </baseAddresses> </host> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="TestServiceHttpBinding" contract="TestWCF.ITestService" /> </service> </services> <bindings> <basicHttpBinding> <binding name="TestServiceHttpBinding" <b style='COLOR: blue'>hostNameComparisonMode="Exact"></b> <security mode="None" /> </binding> </basicHttpBinding> </bindings> </pre> <br /> 클라이언트 측에서는 다음과 같이 설정해 주면 됩니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; width: 800px; background-color: #fbedbb; overflow-x: scroll; font-family: Consolas, Verdana;' > <client> <endpoint address="<b style='COLOR: blue'>http://127.0.0.1:20000</b>/TestService/" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITestService" contract="TestWCF.ITestService" name="BasicHttpBinding_ITestService" /> </client> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_ITestService" ... > </binding> </basicHttpBinding> </bindings> </pre> <br /> 서버에서 127.0.0.1로 설정되어 있죠? 재미있는 것은 클라이언트 측에서 접속 주소가 "http://localhost:20000"으로 하는 것조차도 막는다는 것입니다. 그래서 이런 경우 다음과 같이 예외를 발생시킵니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; width: 800px; background-color: #fbedbb; overflow-x: scroll; font-family: Consolas, Verdana;' > System.ServiceModel.EndpointNotFoundException was unhandled Message="<b style='COLOR: blue'>There was no endpoint listening at http://localhost:20000/TestService</b>/ that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details." Source="mscorlib" StackTrace: Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) ... [중간 생략] ... at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state) InnerException: System.Net.WebException Message="The remote server returned an error: (404) Not Found." Source="System" StackTrace: at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) InnerException: </pre> <br /> <br /><br /><hr /><span style='color: Maroon'>[이 토픽에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]</span> </div>
첨부파일
스팸 방지용 인증 번호
9467
(왼쪽의 숫자를 입력해야 합니다.)