Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Missing reference??

Posted on 2011-02-12
3
Medium Priority
?
2,089 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 2000 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

730 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