Click here to Skip to main content
11,709,366 members (44,269 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET WCF C#4.0 MVC
I have PCS application which is having DAL and Modal layer which is done in MVC3 architecture.Need to create the WCF service, can i use PCS dll in WCF for accessing DAL and modal objects.I tried
public List<> GetCountry()
     List<> lst = new List<>();
     lst[0].CountryName = "India";
    return lst;
WCF Test Client says
"GetCountry operation  is not supported because it uses the type PCSMVC.Country[]"
,please help me on this.
Posted 13-Jul-12 7:22am
Edited 13-Jul-12 7:56am
(no name)285.3K
Trak4Net at 13-Jul-12 15:37pm
From your error message it looks like PCSMVC.Country[] is an array. It looks like you are trying to use it as if it is an object. What is the definition for PCSMVC.Country ? Is it a collection or a single object with properties.

Also, you initialize your list and try accessing first object in list when you haven't added anything to the list yet, I would imagine if it reached that line of code you would get an index out of range error, since the list contains no items.

public List<> GetCountry()

List<> lst = new List<>();
//should add an object of (can initialize properties also)
lst.Add(new { CountryName = "India" });
return lst;
or you can do it this way...

public List<> GetCountry()

List<> lst = new List<>();
//should add an object of
//now the list contains the object and you can access it
lst[0].CountryName = "India";
return lst;
chkrvrthy at 16-Jul-12 9:10am
Thanqu, I got it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 590
1 OriginalGriff 250
2 Maciej Los 225
3 Peter Leow 219
4 Mika Wendelius 160
0 OriginalGriff 9,428
1 Sergey Alexandrovich Kryukov 9,027
2 CPallini 5,189
3 Maciej Los 4,991
4 Mika Wendelius 3,856

Advertise | Privacy | Mobile
Web02 | 2.8.150819.1 | Last Updated 13 Jul 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100