Solved

Missing reference??

Posted on 2011-02-12
3
2,078 Views
Last Modified: 2012-05-11
I've got a C# web service that uses the "XmlDictionaryWriter" object as shown in the code below.  Using the object explorer I can see this is part of "System.XML".  But niether including the reference nor explicit declaration can find the namespace.

This gets extra strange because I have a second project which uses the same exact class, and "XmlDictionaryWriter" IS found.  What is going on here?  One reference is stopping my build.
using System;
using System.ServiceModel.Channels;
using System.Xml;

namespace Batch
{
    public class SampleHeader : MessageHeader
    {
        private string name;
        private string value;

        public SampleHeader(string name, string value)
        {
            this.name = name;
            this.value = value;
        }

        public override string Name { get { return name; } }
        public override string Namespace { get { return "http://monkey.sample.com/doc/2007-01-01/"; } }

        protected override void OnWriteHeaderContents(XmlDictionaryWriter xmlDictionaryWriter, MessageVersion messageVersion)
        {
            xmlDictionaryWriter.WriteString(value);
        }
    }
}

Open in new window

0
Comment
Question by:Phil5780
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Expert Comment

by:BurnieP
ID: 34880192
Hi,

Do you have

using System.Xml.XmlDictionaryWriter;

defined in your using section?
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 34880211
@BurnieP

XmlDictionaryWriter is a class, not a namespace   = )

You need to add a reference to System.Runtime.Serialization. The namespace is still System.Xml though.
0
 

Author Closing Comment

by:Phil5780
ID: 34880375
Solved by recreating my project as an ASP.NET website and not a WSDL project.  It appears XMLDictionaryWriter is not available in a web service project.  (No new references added)
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question