Solved

Missing reference??

Posted on 2011-02-12
3
2,054 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
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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
System.Security 2 27
Problem to refer to value 8 51
Linq asp.net mvc 13 12
FInd Image Control Gridview 3 3
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

825 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