.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

Declaration of dataContractSerializer maxItemsInObjectGraph is not being used when declared in App.c

Posted By:      Posted Date: October 14, 2010    Points: 0   Category :WCF



I have a WCF service with 2 methods, both using a class declared as DataContract...
One of the methods in the class has a list of references to other objects...

So I was getting an error message about maxItemsInObjectGraph and that I needed to increase it...

I declared this parameter on both service sice (in Web.config in service and endpoint behaviour) and on client side (in App.config in endpoint behaviour)...
But, for some reason the client is not using this configuration at all...

I wrote a small console app as a client that uses service reference for testing purposes...
The program has following block of code:

      var client = new MyServiceClient();

      foreach (var operation in client.Endpoint.Contract.Operations)
        Console.WriteLine("\n List of behaviors for operation: [{0}] :", operation.Name);
        foreach (var behaviour in operation.Behaviors)

View Complete Post

More Related Resource Links

'Model' cannot be declared in this scope


I have a complex partial view (ugly stuff), the view page has this line:- 

<% Html.RenderPartial("PartialIndicatorWeighting", indicator);%>
and inside the ugly partial view I have this,
<td><%: Model.Active %><%: Html.CheckBoxFor(Model => Model.Active)%></td>
I'm trying to display a list of checboxes to show if the item is active or not, I get the following error:-
A local variable named 'Model' cannot be 

'__o' is not declared - what does it mean?

I have a web page that has 21 errors all pointing to the same place and each error is the same as this first one::

Error    1    Name '__o' is not declared.    C:\Data\Artwork\web sites\MRL Insurance Direct Web Site\web-content\affiliate\stats1.aspx    97    1    C:\...\web-content\

What does it mean?

{ End Bracket }: The Digital Declaration of Independence


Bill Hill discusses his Digital Declaration of Independence.

Bill Hill

MSDN Magazine Launch 2008

Object declaration problems


 in the vb code below @ 'Print the Amount and Description to the page by placing them in the Spans'
I'm getting messages that the two variables aren't declared, however it seems to be printing them on the form.  Also, I'm getting the same message for all the variables @ 'Update the fields in the actual form'.  This is Auhtorize.Net sample code.  I can't get the code to work.  The error is that the merchant id is invalid and I think it might be because of the "variable not declared" message mentioned above.  Can someone look at the code and, with their asp/vb hat on, see what change I need to make to clear the declaration issues?  Then I'll see if that helps. 

Also, at 'This is a wrapper for the VB.NET's built-in HMACMD5 functionality', I get a message that I am using a function without an 'As' clause.  How do I fix this?



<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="SIM_Example._Default" %>


Function and Variable declaration with out an 'As' clause


I get a message - "Function without an 'As' clause" for HMAC_MD5 and "Variable declaration without an 'As' clause" for Key and Value.  But the code works.  But the messages still exists.  Is there a way to fix this to avoid the messages?

Function HMAC_MD5(ByVal Key, ByVal Value)


Initializing more than one variable at declaration


Guys, i am looking for this using google search but without success yet...

How can I do this:

private string a, b, c, d ,e = "";

I want ALL the variables to start with "" but this is not what i get...  so i am doing this until the answer does not come:

private string a,b,c,d,e;

a = b = c = d = e = "";



Declaration of a Variable in a webform

Hi All, Please review my code, i've removed the most part of the code which is not relevant to this: namespace MyQuiz { public partial class QuizPage : System.Web.UI.Page { protected int[] idquestion = new int[totalQuestions]; public QuizPage() { Page.Init += new System.EventHandler(Page_Init); } private void ReadQuestionsIntoTable() { IEnumerable questions = SelectRows("Select * From Questions WHERE QuizID='48'"); //Ashiq Code int a = 0; foreach (DataRowView question in questions) { a++; } totalQuestions = a; foreach (DataRowView question in questions) { idquestion = new int[totalQuestions]; idquestion[NumberOfQuestions] = Convert.ToInt16(question["QuestionID"].ToString()); } } protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { ReadQuestionsIntoTable(); } else { bool AreAllAnswered = CalculateScore(r);

DataContractSerializer do not verify "xml markup name" / "property name" correspondance

Hello, I use the DataContractSerializer o serialize / deserialize a complex class. During deserialisation, if an XML markup does not correspond to any property of my class, or if a property of the class is not present in the XML, there is not a single warning. This is problematic if a user make an invalid modification in the xml, or if a developer make a refactor in the code... How can I change this behavior ?   Thanks for your time.

DataContractSerializer deserialization puzzle - by-pass member initialization.

Hi, I was using WCF and during the transmission of a object, of the type Book, see code below, the deserialization process throws a NullReferenceException. To isolate the problem, I uses a unit test like this rather than involving the full blown WCF marshalling. This appears to be solely a serialization/deserialization problem and has nothing to do with the communication issues in WCF. [Test] public void TestSerializeAndDeserializeBook() {     Book book = new Book( "Testing Serialization and Deserialization",                         new Person( 100, "Tom", "Smith" ),                         new Person( 101, "Peter", "Pan" ) );     DataContractSerializer ser = new DataContractSerializer( typeof(Book) );     using( Stream stm = new MemoryStream() )     {         ser.WriteObject( stm, book );         stm.Seek( 0, SeekOrigin.Begin );         Book regen = ser.ReadObject( stm ) as Book; // NullReferenceException here     &nb

Setting maxItemsInObjectGraph in a WCF REST config file???

Hi All, I am trying to create a new WCF Rest service. I used the online VS2010 WCF REST 4.0 template as a base. I have a service up and running and have been testing it using IE/Firefox (currently it is a read only API, so I have no need to post anything back to the service). I have an issue when the number of items being returned is too large, IE give me a "Internet Explorer cannot display the webpage" I turned on tracing and was able to confirm the issue is with the maxItemsInObjectGraph property (defaults to 65536) <Message>Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota. </Message> Using the defualt WCF Web.config file I have no clue how to set this value as it doesnt seem like a standardEndpoint can have this value set, or have a custom binding or behaviour assigned to them (at least I don't know how to set them). Here is the default web.config file the template created. Does anyone know how i can update/increase the maxItemsInObjectGraph property?      <system.serviceModel>    <diagnostics>      <endToEndTracing propagateActivity="true" activityTracing="true"   &nb

'variable' is not declared. It may be inaccessible due to its protection level.

I have been trying to get a value from my sql database to post to the form I have.  I have thought i was pretty close but it keeps giving me the error "User_EmailTextBox is not declared.  It may be inaccessible due to its protection level".  I have been trying to get this to work for a week and I can't seem to figure it out.  Any help would be appreciated.  My code is below.web.config ---------------------------------------------------------------------------- <?xml version="1.0"?> <configuration> <connectionStrings> <add name="ECDRConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ECDR.mdf";Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient" /> </connectionStrings> <system.web> <compilation debug="false" targetFramework="4.0" /> </system.web> <!--Mail settings--> <system.net> <mailSettings> <smtp> <network host="YOUR HOST HERE"/> </smtp> </mailSettings> </system.net> <!--Mail settings--> </configuration> --------------

The 'http://www.w3.org/2001/XMLSchema:schema' element is not declared.

Hi all,i have created  a .net webservice which returns DataSet in a webmethod but the problem is that when i validate service.wsdl file it gives me following error:Warning 35 The 'http://www.w3.org/2001/XMLSchema:schema' element is not declared. E:\Santosh\projects\asp.net\MFONLINE\MFONLINE NEW\App_WebReferences\HDFCMF\Service.wsdl 771 20 E:\...\MFONLINE NEW\ The 'http://www.w3.org/2001/XMLSchema:schema' element is not declared.Do any one have any idea ?-Thanks

How to I apply an XAML declared animation to multiple controls dynamically?

Hello, How to I apply an XAML declared animation to multiple controls dynamically? Here is the XAML declared animation: <Window.Resources> <Storyboard x:Key="TextBlock_SB"> <DoubleAnimation Storyboard.TargetName="TextBlock_1" Storyboard.TargetProperty="(TextBlock.Opacity)" From="1.0" To="0.75" Duration="0:0:0.5" AutoReverse="True" RepeatBehavior="Forever" /> </Storyboard> Here is the code that starts the animation for TextBlock_1: (this.Resources["TextBlock_SB"] as Storyboard).Begin(); I want to apply the same storyboard/animation to TextBlock_2 and TextBlock_3 and perhaps others.  How do I do that without defining more XAML storyboards? Regards, Robert  

CA1063 : Microsoft.Design : Ensure that 'PageContentGrid.Dispose()' is declared as public and seal

OK... I'm getting my DB context like so: private ssCMSDataContext _dataContext; protected ssCMSDataContext DbContext { get { if (_dataContext == null) { _dataContext = new ssCMSDataContext(); } return _dataContext; } } public override void Dispose() { if (_dataContext != null) { _dataContext.Dispose(); } base.Dispose(); } When I run the code analysis I get the following warnings:  "CA1063 : Microsoft.Design : Ensure that 'PageContentGrid.Dispose()' is declared as public and sealed." "CA1063 : Microsoft.Design : Modify 'PageContentGrid.Dispose()' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns.  I don't understand what it wants me to do?  Little help....  

The 'DataType' attribute is not declared bug of MS SQL RS still here

Greetings. I am getting repeated bugs with reporting services that is described here https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=405739&wa=wsignin1.0 In short words, BIDS is saving the report in the wrong format, adding attributes to the tags that dont belong to the schema, and you can no longer open the report with BIDS, you have to carve those attributes out with Notepad, only to find out that next time you're working on it, they come back! This is getting seriously annoying as i virually cannot close my BIDS anymore, each time i want to reopen my project i have to edit it in the notepad!  Threre are words about "microsoft knows about this issue and changed it to "Fixed (External)" but noone knows how to install the fix... Help please.

Event Handle & Declared Message Errors

Hi Experts: There is a missing event Handle that requires a variable found in the button code . Secondly,  there is a Name declared error (i.e., Name 'First' is not declared, Name 'Last' is not declared, Name 'City' is not declared, Name 'State' is not declared) found in the page code. How do we revise the codes to remove the message errors? Go to the following URL link to view 'High Res' screen shots at http://cforedu.com/screen.pdf Here is the page code:<%@ Page Language="VB" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <script runat="server"> Protected Sub Save(sender As Object, e As EventArgs) Dim First As TextBox = TryCast(Me.fvApplication.FindControl("First"), TextBox) Dim Last As TextBox = TryCast(Me.fvApplication.FindControl("Last"), TextBox) Dim City As TextBox = TryCast(Me.fvApplication.FindControl("City"), TextBox) Dim State As TextBox = TryCast(Me.fvApplication.FindControl("State"), TextBox) End Sub </script> </head> <body> <form id="form1" runat="server"> <div> <asp:FormView runat="server" ID="fvApplicatio

xml nodes query on DataContractSerializer string

Hi I need to get a table from this xml, I have some experience using nodes but am getting nowhere on this string.  It is produced from DataContractSerializer on a list with one of the columns a dictionary.  Any help will be much appreciated!  declare @xml xml = ' <ArrayOfArmorDeviceBase xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://server.armor.com/contract/data">   <ArmorDeviceBase xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" z:Id="i1" i:type="ArmorSimpleDevice">     <Id>5000</Id>     <SiteId>0</SiteId>     <SourceSystem>Armor</SourceSystem>     <DataGroups xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">       <d3p1:KeyValueOfstringDeviceDataGroupBaseRRFhSxY9>         <d3p1:Key>CommunicationStatus</d3p1:Key>         <d3p1:Value xmlns:d5p1="http://server.armor.com/contract/data/ControllerStatus" i:type="d5p1:CommunicationStatus">           <Ticks>0</Ticks>           <d5p1:Status>Disco
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