Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6968977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:31:20+00:00 2026-05-27T16:31:20+00:00

I’m getting StackOverflowException at this line. I’m kind of new to WCF but as

  • 0

I’m getting StackOverflowException at this line. I’m kind of new to WCF but as far as i can see it’s not called in an infinity loop. Well i was hoping someone here could shed some light on this problem.

 get { return LevStad; }

The code.

 // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract]
    public interface IService
    {
        [OperationContract]
        string GetData(int value);
    [OperationContract]
    Kund GetDataUsingDataContract(Kund kund);

    // TODO: Add your service operations here
}
[DataContract]
public class Kund
{
    int iD;
    string fornamn = "";
    string efterNamn = "";
    string telefon = "";
    string boAdress = "";
    string boPostnummer = "";
    string boStad = "";
    string boLand = "";
    string levAdress = "";
    string levPostnummer = "";
    string levStad = "";
    string levLand = "";

    [DataMember]
    public int ID
    {
        get { return iD; }
        set { iD = value; }
    }

    [DataMember]
    public string Fornamn
    {
        get { return fornamn; }
        set { fornamn = value; }
    }
    [DataMember]
    public string EfterNamn
    {
        get { return efterNamn; }
        set { efterNamn = value; }
    }
    [DataMember]
    public string Telefon
    {
        get { return telefon; }
        set { telefon = value; }
    }
    [DataMember]
    public string BoAdress
    {
        get { return boAdress; }
        set { boAdress = value; }
    }
    [DataMember]
    public string BoPostnummer
    {
        get { return boPostnummer; }
        set { boPostnummer = value; }
    }
    [DataMember]
    public string BoStad
    {
        get { return boStad; }
        set { boStad = value; }
    }
    [DataMember]
    public string BoLand
    {
        get { return boLand; }
        set { BoLand = value; }
    }
    [DataMember]
    public string LevAdress
    {
        get { return levAdress; }
        set { levAdress = value; }
    }
    [DataMember]
    public string LevPostnummer
    {
        get { return levPostnummer; }
        set { levPostnummer = value; }
    }
    [DataMember]
    public string LevStad
    {
        get { return LevStad; }
        set { levStad = value; }
    }
    [DataMember]
    public string LevLand
    {
        get { return levLand; }
        set { levLand = value; }
    }
}

    public class Service : SQLBase, IService
    {
        public Service() : base()
        {

        }
        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }
        public Kund GetDataUsingDataContract(Kund kund)
        {
            kund = new Kund();
            SqlCommand SQLCom = new SqlCommand(@"SELECT Kund.ID, Förnamn, Efternamn, Telefon, Adress, Postnummer, Stad, Land 
FROM Webbshop.dbo.Kund INNER JOIN Webbshop.dbo.Adress ON Kund.BoAdress = Adress.ID");
            SQLCom.Connection = DatabaseConnection;
            SQLCom.Connection.Open();
            SqlDataReader rdr = SQLCom.ExecuteReader(); 
            while (rdr.Read())
            {
                kund.ID = (int) rdr[0];
                kund.Fornamn = rdr[1].ToString().Trim();
                kund.EfterNamn = rdr[2].ToString().Trim();
                kund.Telefon = rdr[3].ToString().Trim();
                kund.BoAdress = rdr[4].ToString().Trim();
                kund.BoPostnummer = rdr[5].ToString().Trim();
                kund.BoStad = rdr[6].ToString().Trim();
                //kund.BoLand = rdr[7].ToString().Trim();
                //kund.LevAdress = rdr[8].ToString();
                //kund.LevPostnummer = rdr[9].ToString();
                //kund.LevStad = rdr[10].ToString();
                //kund.LevLand = rdr[11].ToString();
            }
            SQLCom.Connection.Close();
            return kund;
        }
    }

public class SQLBase
{
    protected static SqlConnection DatabaseConnection = new SqlConnection();
    public SQLBase()
    {
        DatabaseConnection.ConnectionString =
           "Data Source=(local);Initial Catalog=Webbshop;Integrated Security=True";
    }
}

Kund kund = null;// = new Kund();
using (ServiceReference.ServiceClient wcfClient = new ServiceReference.ServiceClient())
{
    kund = wcfClient.GetDataUsingDataContract(kund);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:31:20+00:00Added an answer on May 27, 2026 at 4:31 pm

    It’s the capitalization. It should return the variable:

    get { return levStad; }

    Right now, it’s returning itself, which calls get, which returns itself… stack overflow.


    You’ll also have an issue with BoLand; set will set itself, which will call set… again, capitalization:

    public string BoLand
    {
        get { return boLand; }
        set { boLand = value; }
    }
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.