Answered by:
Missing namespace in svcUtil generated proxy class.

Question
-
Thogh this is not a problem as you can add proxy class in app_code and acces it.
But it is interesting why m i missing Namespace in my proxy class
i have contract like this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Description;namespace MyGreetings
{
[ServiceContract(Namespace="AshwaniWCF")]
public interface IGreeting
{
[OperationContract]
string GreetMessage(string Message);}
public class Greeting : IGreeting
{
#region IContract Memberspublic string GreetMessage(string Message)
{
return "Message we got is{0}." + Message;
}#endregion
}}
and i get proxy like
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3082
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[System.CodeDom.Compiler.
GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.
ServiceContractAttribute(Namespace="AshwaniWCF", ConfigurationName="IGreeting")]
public
interface IGreeting
{
[System.ServiceModel.
OperationContractAttribute(Action="AshwaniWCF/IGreeting/GreetMessage", ReplyAction="AshwaniWCF/IGreeting/GreetMessageResponse")]
string GreetMessage(string Message);
}
[System.CodeDom.Compiler.
GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
public
interface IGreetingChannel : IGreeting, System.ServiceModel.IClientChannel
{
}
[System.Diagnostics.
DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.
GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
public
partial class GreetingClient : System.ServiceModel.ClientBase<IGreeting>, IGreeting
{
public GreetingClient()
{
}
public GreetingClient(string endpointConfigurationName) :
base(endpointConfigurationName)
{
}
public GreetingClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public GreetingClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public GreetingClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}
public string GreetMessage(string Message)
{
return base.Channel.GreetMessage(Message);
}
}
you can see no name space available here?
Thursday, July 8, 2010 9:48 AM
Answers
-
There's a namespace switch on the svcutil.exe utility.
/namespace:<string,string>
so, add the option below to map to your own namespace.
..... /namespace:*,MyNamespace- Proposed as answer by praveen mishra Friday, July 9, 2010 11:25 AM
- Marked as answer by Docait Friday, July 9, 2010 12:39 PM
Friday, July 9, 2010 11:25 AM
All replies
-
There's a namespace switch on the svcutil.exe utility.
/namespace:<string,string>
so, add the option below to map to your own namespace.
..... /namespace:*,MyNamespace- Proposed as answer by praveen mishra Friday, July 9, 2010 11:25 AM
- Marked as answer by Docait Friday, July 9, 2010 12:39 PM
Friday, July 9, 2010 11:25 AM -
If you use the /namespace switch, won't that become the namespace for all generated classes? I want to maintain the namespace structure from the service.Tuesday, July 1, 2014 10:44 PM