By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,971 Members | 1,732 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,971 IT Pros & Developers. It's quick & easy.

SoapExtension and System.Configuration.ConfigurationException

P: n/a
Hi All,

I've just written a small program to use a locally hosted webservice
which works fine.

However I've also written a SOAPExtension for the client and I'm having
trouble with the configuration (getting a ConfigurationException
complaining about a valid type name).

The following is the coded DebugExtension which extends SoapExtension

public class DebugExtension : SoapExtension {
Stream oldStream;
Stream newStream;

public DebugExtension(){}

public override Stream ChainStream(Stream stream){
oldStream = stream;
newStream = new MemoryStream();
return newStream;

public override object GetInitializer(Type t){
return null;

public override object GetInitializer(LogicalMethodInfo l,
SoapExtensionAttribute sea){
return null;

public override void Initialize(object o){
//do nothing

public override void ProcessMessage(SoapMessage message) {
// This won't execute if deployed on the service side.
if (message is SoapClientMessage)
Display d;
switch (message.Stage)
case SoapMessageStage.BeforeSerialize:
case SoapMessageStage.AfterSerialize:
d = new Display();
case SoapMessageStage.BeforeDeserialize:
d = new Display();
case SoapMessageStage.AfterDeserialize:
throw new Exception("invalid stage");

public class DebugExtensionAttribute : SoapExtensionAttribute
private int priority;
public override Type ExtensionType
get { return typeof(DebugExtension); }

public override int Priority
get { return priority; }
set { priority = value; }

I have the following app.config:
<?xml version="1.0" encoding="utf-8"?>
<section name="microsoft.web.services2"
type="Microsoft.Web.Services2.Configuration.WebSer vicesConfiguration,
Microsoft.Web.Services2, Version=, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" />
<diagnostics />
<add type="DebugExtension"
group="0" />

When running the program I get the following error:
"An unhandled exception of type
'System.Configuration.ConfigurationException' occurred in system.dll

Additional information: The 'type' attribute must be set to a valid
type name."

However commenting out the System.web node and all it's children
elimnates the error (the extension doesn't run of course). I've also
tried adding a type of type="Debug.DebugExtension" were Debug is the
namespace in which the entire project resides.

Any input appreciated,

Jan 9 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.