.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

WCF service returning old values

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :ASP.Net
Hi. I am developing an application with WCF services. The basic functionaloty of a screen is to provide an entry screen to add particular entity. Once save even fired It will save the data to the database and call the bind method to bind into the grid by refreshing the latest data. When I am running the site from my source (Visual Studio) , it works perfectly. When the client calls method to fetch the data the WCF service, it returns latest (added) data. But the issue comes in the server when it works with IIS. I deployed the code in the server, once the data added I am getting the old data only. But after two refresh I am getting the latest data. Could you please let me know what required to be done to get the latest record. Many Thank, Kelvin Kumar

View Complete Post

More Related Resource Links

Control Values When Returning to Page


Why do controls value not persist when returning to a page (e.g. via browser back button)?  If I set control values without utilizing a post back the controls will maintain their last value when I return to the page.  If I set a control value and then call a post back, the control value is reset to the default value when returning.

I have many pages with a gridview, and a textbox which is used to filter the gridview contents.  I set the filter textbox, filter the gridview (postback), go to another page, and when I return to the gridview page (via back button), my filter textbox is reset empty, and the gridview is the original (unfiltered) data.

What concept am I missing here?

Thanks in advance...

Error calling WCF service that is returning list.".Debugging resource strings are unavailable ......

Ok.this is just making me frustrated... Here is step by step of what I am trying to do (& not able to) 1. I am calling WCF service hosted in a SharePoint 2010 site from a silverlight app in same domain (So no cross doman I guess). 2. I use Linq to Sharepoint for querying the DB. 3. I am having a list "machines" in Sharepoint 2010 that is having a lookup column from Other list called "part" 4. My WCF method GetAllMachines() works perfectly well when it skips the lookup column "partname" & returns List of type machineitem. 5. But problem occurs when I add machineitemobject.parts.partsname in my Linq to Sharepoint query . My service gives the error not found Async_ExceptionOccurred] Arguments: Debugging resource strings are unavailable." 6. Note that return type of my Method is List<machinesitem> 7. The point to note here is that I use SPMETAL tool to generate the LINQ class that maps the lists . So When I try to query the lookup column it tries to add List item of the type class & that is what causing the error. Is it because I am not using datacontract in my service (but it returns the strings & all private members of machines list e.g. name,title etc) Is it making the attribute Serialisable will solve the error ??? I am kind of lost in it ...Plss help!!   Thanks

Gridview RowCommand Event returning null values

HiI'm trying to retreive values entered by users in the textboxes in the footer of the gridview and insert these values into another sql table.My code is as follows :-protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)    {       if(e.CommandName.Equals("addnew"))       {                       TextBox t1 = (TextBox)GridView2.FooterRow.FindControl("tfrm");            string frm = t1.Text;            TextBox t2 = (TextBox)GridView2.FooterRow.FindControl("tsub");            string sub = t2.Text;            string cmd = "insert into suggestions values('" + frm + "','" + sub + "','c','c')";            con.Open();            SqlCommand com = new SqlCommand(cmd,con);            int a = com.ExecuteNonQuery();&n

Process.Modules Not Returning Correct Values in x64

Hey All!   Here is my problem, when i use the following code:   Process hProcess = (.....); foreach (ProcessModule m in hh.Modules) { Console.WriteLine(m.ModuleName + " - " + m.BaseAddress); }   On a 32bits machine I get like 20 different values, those are the ones I use further in my program. However in a 64bits machine I only get: myexe.exe, ntdll.dll, wow64.dll, wow64win.dll and wow64cpu.dll.   I also tried EnumProcessModules, but got the same result.   How may I get the correct values I need?   My .NET exe is compiled at 32bits and the target process is also 32bits.   Thanks, Best Regards, Mywk

Custom membership provider not returning values from my web.config


I created a custom membership provider in my ASP.NET 4.0 web site, stored  in App_Code, and referenced in my web.config.

However, it doesn't appear to be pulling values out of web.config during initialization.

The code was taken from http://www.asp.net/general/videos/how-do-i-create-a-custom-membership-provider, and the only modifications were changing "connectionStringName" here to the name of my connection string:

    Dim ConnectionStringSettings As ConnectionStringSettings = _

The connection string always comes back as nothing in this line:

    If ConnectionStringSettings Is Nothing OrElse ConnectionStringSettings.ConnectionString.Trim() = String.Empty Then
      Throw New ProviderException("Connection string cannot be blank.")
    End If

No matter what I change the password format to in web.config, the default value here is always used:

    Dim temp_format As String = config("passwordFormat")
    If temp_format Is Nothing Then
      temp_format = "Has

wcf returning a list from wcf service - I have lots of locations and I want to return the locations


How is it possible to return some kind of list from a wcf serivce, this the method in my wcf service 
my interface:

    [WebInvoke(Method = "GET",
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Wrapped,
        UriTemplate = "Locations")]
    IList<Location> GetLocations();

 public IList<Location> GetLocations()
        Pazar.Data.Repositories.LocationRepository locRepository = new Pazar.Data.Repositories.LocationRepository();
        return locRepository.GetRootLocations().ToList<Location>();

and this how my GetRootLocations looks like, It returns IQueryable, I wounder if I can maybee return Iqueryable from my svc-service?

public IQueryable<Location> GetRootLocations()
        IQueryable<Location> locations = GetAll().Where(p => !p.ID_Parent.HasValue).OrderBy(p => p.Sequence);
        return locations;

spgridview RowDataBound event returning cell values as empty


i am working with SPGridView to display Announcements. User should be able to edit his own created Announcements.Remaining Items shouldnt be having edit option.

i created SPGridView Columns :

                SPBoundField Title = new SPBoundField();
                Title.HeaderText = "Title";
                Title.HeaderStyle.Font.Bold = true;
                Title.DataField = "Title";

                SPBoundField Description = new SPBoundField();
                Description.HeaderText = "Description";
                Description.DataField = "Description";


User Profile Service not returning security groups


I just got the User Profile Service working, and tried using GetCommonMemberships but I am only getting Distro lists and Sharepoint groups.  No security groups (Domain Local, Global, Universal) are showing up.

I did come across one post where someone was not running in Native mode AD, its possible since I *JUST* ADPrepped and added a 2008 DC today that I'm back in a mixed mode and that is the problem...?  Seems weird tho.   Just checked on the new 2008 DC it says Windows 2003 mode or something along those lines

Sharepoint itself is able to see and use the security groups.  If I change permissions on a List or library, I am able to select security groups.  It seems specific to the User Profile Service.

A little more looking... it seems that DL's show up, and Universal security groups show up.  Domain Local and Domain Global security groups do not.




TableAdapter Fill() not returning result over WCF Service


Firstly I must mention I'm new to WCF and relatively new to .NET Development - so what I'm doing might not be the best way to do it.


My problem is that when I indirectly use a table adapter's Fill() over a WCF Service connection to fill a strongly typed DataTable - it fills the table, but in the calling function, the table remains empty.


I’m busy creating a proof-of-concept using Visual Studio 2010 Professional on Windows 7 Professional accessing MS SQL 2008.

I’m trying to create an n-tier setup and thus have the following 5 projects:

1. "MsSqlDataAccess" - a project containing the TableAdapters from a strongly typed dataset.

2. "Entity" - I've separated my DataSet from the "MsSqlDataAccess" to be in this project.

3. "Comm" - WCF Service using netTCPBinding.

 - This makes available GetUsers() and FillUsers().

 - FillUsers() can either take a dataset or a datatable.

 - Above mentioned methods call the applicable TableAdapter methods.

4. "Service" - a Windows Service hosting the WCF Service.

5. "WpfTestClient" - a WPF client consuming the service.


I can return a filled DataTable when I use the TableAdapter's Get() method via the WCF service's GetUsers() method.<

Assigning XML Tag Names Within ASP Web Service Returning Jagged Array



I am using an ASP webservice to return a jagged array.  I need to be able to define the tags names in the XML which is returned.  How do I do this?


Code and Example XML follow.




        orderListId = new string[100];
        orderListTime = new string[100];
        orderListEmail = new string[100];
        orderListStatus = new string[100];
        orderListSubtotal = new string[100];

        int orderCount = 0;
        foreach (DataRow drRow in dtResult.Rows)
            orderListId[orderCount] = (drRow["SubmittedFormId"].ToString());
            orderListTime[orderCount] = (drRow["SubmitTime"].ToString());
            orderListEmail[orderCount] = (drRow[&quo

How to bind distinct values to DropDownList from DataSet (as a result of a web service call)?


Hi there,

I'm trying to bind a dataset (where the data is coming from a webservice) to a dropdownlist; the problem is that I'm getting duplicates in the list... how can I display distinct values only:

drp_Brand.DataSource = ds.Tables[0];
            drp_Brand.DataTextField = "Brand";
            drp_Brand.DataValueField = "Brand";



GetUserProfileByName method in userprofileservice.asmx returns null values when used in Service Refe


I'm using Silverlight 4 to call GetUserProfileByName method of the SharePoint 2007 userprofileservice.asmx web service. For each of the PropertyData in the e.Result object that is returned, the Values array is null.

Below is the Completed event handler. Execution gets inside the if block for each of the PropertyData.


void client_GetUserProfileByNameCompleted(object sender, GetUserProfileByNameCompletedEventArgs e)
 foreach (PropertyData prop in e.Result)
  if (prop.Values == null) // this is ALWAYS true for each prop


After some investigation, I've found out this only happens when userprofileservice.asmx is added as a Service Reference. I tested this out by creating an ASP.NET project. In it I added userprofileservice.asmx as a Web Reference, and then as a Service Reference. For the Web Reference case,

WCF Service returning DataTable for silverlight client



I am creating a WCF 3.0 service which will fetch data from the database and return mostly in DataTable and DataSet format. I am building a Silverlight client for consuming this service. But what I found is Silverlight 3.0 does not support datatable or dataset. Unfortunately most of my datas are returned in the datatable format. Is there any way to consume datatable in silver light or converting datatable to generic list or LINQ before returning them? If it is possible to convert datatable to generic collection, does it possible without iteration? This is because converting hundreds of records by iterating will affect my performance.

Thanks in Advance!!!!

Best regards,
Subalakshmi Vijayarajan.

Subalakshmi Vijayarajan.

WCF service over https returning error


I am trying to deploy a wcf service. I have created a simple service, basically I have created a new wcf service and tried to deploy it however I get this error

The type 'WCF_Application.Service1', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.


I am trying to deploy my service to a subdomain like https://services.mydomain.com/business


My config looks like this


      <service name="WCF_Application.Service1">
        <endpoint address="Business" binding="wsHttpBinding" contract="WCF_Application.IService1"
            <dns value="services.mydomain.com" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <add baseAddress="https://services.mydomain.com/" />

Class Not returning accurate values


Hello guys,

Please can anyone look at this class and say why it's just returning just the first row in the second query, the issue is that the

Salary is showing the right value when debugging, but when deployed to IIS it's just returning the 1st row

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Linq
Imports Telerik.Web.UI
Imports EMPTaxesLINQ
Namespace EmployeeTaxes.DataLoad
    Public Class GetData
        Public Shared Function GetSalary(ByVal sEmployeeID, ByVal Sdate, ByVal Edate) As Decimal

            Dim sMonth, eMonth, sYear, sEMPID, AbsenceTotal, SalaryType As Integer
            Dim DailyRate As Decimal
            Dim db As New EMPTaxesLINQ.EMPDCDataContext()
            Dim salary As Decimal = 0
            sEMPID = Convert.ToInt32(sEmployeeID)
            'get salary type

WCF service hosted in IIS 7 returning error "Security settings for this service require 'Anonymous'

Using the CalculatorService provided as a WCF sample from MSDN, I tried to host it as an application in IIS 7. The virtual folder in IIS is configured as Basic Authentication enabled and Anonymous Authentication disabled. I don't have any certificates setup. This is all hosted in a single machine setting. Each time I access the service through a browser, I'm getting the error "Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service".

Below is my web.config --

Can someone please provide some answer, I don't want to enable Anonymous authentication in IIS. I even set the 

aspNetCompatibilityEnabled = true.

<?xml version="1.0"?>


select returning a list of values seperated by commas


I’m performing a select statement that returns the primary key of all the records matching  certain criteria. Instead of the returned set having  a row for each record returned, I want to just return just  one record that consists of a text field containing all the primary keys separated by commas.


For example:

Select personID from people

Where age < 45


Instead of:

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend