출처: http://blog.naver.com/techshare?Redirect=Log&logNo=100130963761
윈폰 프로젝트에서 WCF 서비스 참조할 때 Reference.cs 파일이 비어있는 경우
윈폰 7용 응용 프로그램을 만들어보신 분은 경험하셨을 것 같은데요. 제 경우에는 "Beginning Windows Phone 7 Development"라는 책의 예제를 따라하던 중이라서 다소 황당하기도 했습니다.
책에 나온데로 NotepadService WCF 서비스에 대한 참조를 추가하게 되면 다음과 같은 식으로 Reference.cs 파일이 생성됩니다. (프록시 관련 코드들이 없습니다.)
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.235 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------
이와 관련해서 검색을 해보니, 다음과 같은 글들이 나오는데요.
Adding Service Reference : Reference.cs is empty ; http://www.amkohartman.nl/post/2009/07/23/Adding-Service-Reference-results-in-empty-Referencecs(Referencevb).aspx WCF Service References Generating Empty Proxy Classes ; http://chrisdomino.com/Blog/Post/WCF-Service-References-Generating-Empty-Proxy-Classes Proxy class not available for Windows Phone 7 Reference to WCF Service ; http://stackoverflow.com/questions/6133418/proxy-class-not-available-for-windows-phone-7-reference-to-wcf-service
아쉽게도 제 경우에 해당하는 글은 없었습니다. svcutil.exe로 직접 지정해 보니, 정상적으로 코드를 담고 있는 파일들이 출력되는 걸로 봐서는 서비스 측의 문제는 없는 것 같습니다.
D:\...[생략]...\WindowsPhoneApplication1>svcutil http://127.0.0.1:83/NotepadWebService.svc?wsdl Microsoft (R) Service Model Metadata Tool [Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.1] Copyright (c) Microsoft Corporation. All rights reserved. Attempting to download metadata from 'http://127.0.0.1:83/NotepadWebService.svc?wsdl' using WS-Metadata Exchange or DISCO. Generating files... D:\...[생략]...\WindowsPhoneApplication1\NotepadWebService.cs D:\...[생략]...\WindowsPhoneApplication1\output.config
하지만 기본적으로 .NET Framework 데스크 탑 버전의 소스 코드를 생성하기 때문에, 이런식으로 직접 생성된 소스 코드를 윈폰 프로젝트에 추가해서 사용하기에는 향후 유지 보수 면에서 무리가 있었습니다.
혹시나 싶어, 나름대로 이리저리 옵션 조정을 해보니 다음과 같은 상황에서 정상적으로 Reference.cs 파일이 생성되었습니다.
Collection type: System.Collections.ObjectModel.ObservableCollection 이외의 값
Reuse types in referenced assemblies: 해제
이유를 모르겠군요. 윈폰용 닷넷에서도 System.Collections.ObjectModel.ObservableCollection<> 타입이 지원되고 있는데다, 솔루션에 정의된 별도의 프로젝트를 참조하고 있지 않은 윈폰 프로젝트에서 "Reuse types in referenced assemblies" 옵션을 해제해야만 WCF 프록시 코드가 생성된다는 것은 이해가 되질 않습니다.
'Language > C#' 카테고리의 다른 글
MyBatis.NET 기본 및 환경 설정 (0) | 2016.02.04 |
---|---|
MyBatis.NET CRUD(2) - mySql DB연동 (0) | 2016.02.04 |
XSL 기본문법 (0) | 2016.02.04 |
XSLT를 이용한 스타일시트 만들기 (0) | 2016.02.04 |
html 특수문자 (0) | 2016.02.04 |