Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

윈폰 프로젝트에서 WCF 서비스 참조할 때 Reference.cs 파일이 비어있는 경우


윈폰 7용 응용 프로그램을 만들어보신 분은 경험하셨을 것 같은데요. 제 경우에는 "Beginning Windows Phone 7 Development"라는 책의 예제를 따라하던 중이라서 다소 황당하기도 했습니다.

책에 나온데로 NotepadService WCF 서비스에 대한 참조를 추가하게 되면 다음과 같은 식으로 Reference.cs 파일이 생성됩니다. (프록시 관련 코드들이 없습니다.)

//------------------------------------------------------------------------------
// 
//     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.
// 
//------------------------------------------------------------------------------

이와 관련해서 검색을 해보니, 다음과 같은 글들이 나오는데요.

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 파일이 생성되었습니다.

how_to_add_svc_ref_in_wp7_1.png

Collection type: System.Collections.ObjectModel.ObservableCollection 이외의 값
Reuse types in referenced assemblies: 해제

이유를 모르겠군요. 윈폰용 닷넷에서도 System.Collections.ObjectModel.ObservableCollection<> 타입이 지원되고 있는 데다, 솔루션에 정의된 별도의 프로젝트를 참조하고 있지 않은 윈폰 프로젝트에서 "Reuse types in referenced assemblies" 옵션을 해제해야만 WCF 프록시 코드가 생성된다는 것은 이해가 되질 않습니다.

일단, 오늘은 이걸로 끝!




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 7/18/2021]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




1  2  3  [4]  5  6  7  8  9  10  11  12  13  14  15  ...
NoWriterDateCnt.TitleFile(s)
13539정성태1/26/20242372개발 환경 구성: 703. Visual Studio - launchSettings.json을 이용한 HTTP/HTTPS 포트 바인딩
13538정성태1/25/20242426닷넷: 2211. C# - NonGC(FOH) 영역에 .NET 개체를 생성파일 다운로드1
13537정성태1/24/20242527닷넷: 2210. C# - Native 메모리에 .NET 개체를 생성파일 다운로드1
13536정성태1/23/20242601닷넷: 2209. .NET 8 - NonGC Heap / FOH (Frozen Object Heap) [1]
13535정성태1/22/20242471닷넷: 2208. C# - GCHandle 구조체의 메모리 분석
13534정성태1/21/20242260닷넷: 2207. C# - SQL Server DB를 bacpac으로 Export/Import파일 다운로드1
13533정성태1/18/20242484닷넷: 2206. C# - TCP KeepAlive의 서버 측 구현파일 다운로드1
13532정성태1/17/20242366닷넷: 2205. C# - SuperSimpleTcp 사용 시 주의할 점파일 다운로드1
13531정성태1/16/20242275닷넷: 2204. C# - TCP KeepAlive에 새로 추가된 Retry 옵션파일 다운로드1
13530정성태1/15/20242209닷넷: 2203. C# - Python과의 AES 암호화 연동파일 다운로드1
13529정성태1/15/20242088닷넷: 2202. C# - PublishAot의 glibc에 대한 정적 링킹하는 방법
13528정성태1/14/20242232Linux: 68. busybox 컨테이너에서 실행 가능한 C++, Go 프로그램 빌드
13527정성태1/14/20242156오류 유형: 892. Visual Studio - Failed to launch debug adapter. Additional information may be available in the output window.
13526정성태1/14/20242242닷넷: 2201. C# - Facebook 연동 / 사용자 탈퇴 처리 방법
13525정성태1/13/20242209오류 유형: 891. Visual Studio - Web Application을 실행하지 못하는 IISExpress
13524정성태1/12/20242296오류 유형: 890. 한국투자증권 KIS Developers OpenAPI - GW라우팅 중 오류가 발생했습니다.
13523정성태1/12/20242098오류 유형: 889. Visual Studio - error : A project with that name is already opened in the solution.
13522정성태1/11/20242241닷넷: 2200. C# - HttpClient.PostAsJsonAsync 호출 시 "Transfer-Encoding: chunked" 대신 "Content-Length" 헤더 처리
13521정성태1/11/20242302닷넷: 2199. C# - 한국투자증권 KIS Developers OpenAPI의 WebSocket Ping, Pong 처리
13520정성태1/10/20242072오류 유형: 888. C# - Unable to resolve service for type 'Microsoft.Extensions.ObjectPool.ObjectPool`....'
13519정성태1/10/20242129닷넷: 2198. C# - Reflection을 이용한 ClientWebSocket의 Ping 호출파일 다운로드1
13518정성태1/9/20242383닷넷: 2197. C# - ClientWebSocket의 Ping, Pong 처리
13517정성태1/8/20242218스크립트: 63. Python - 공개 패키지를 이용한 위성 이미지 생성 (pystac_client, odc.stac)
13516정성태1/7/20242339닷넷: 2196. IIS - AppPool의 "Disable Overlapped Recycle" 옵션의 부작용
13515정성태1/6/20242616닷넷: 2195. async 메서드 내에서 C# 7의 discard 구문 활용 사례 [1]
13514정성태1/5/20242297개발 환경 구성: 702. IIS - AppPool의 "Disable Overlapped Recycle" 옵션
1  2  3  [4]  5  6  7  8  9  10  11  12  13  14  15  ...