power_settings_new

how to remove http://tempuri.org/Imports from wcf

by
asked
0 votes
145 views
I created one WCF. It shws

targetNamespace="http://tempuri.org/Imports" in schema.

 

How do I remove it?

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

answered by (171 points)
0 votes

Usually http://tempuri.org/Imports is default in namespace. You can eleminate it by declaring the namespance.

First, declare it into service contract,

[ServiceContract(Namespace = Constants.Namespace)]
public interface IService1
{
[OperationContract]
void DoWork();
}
 
Now decoare namespace into service.
 
[ServiceBehavior(Namespace = Constants.Namespace)]
public class Service1 : IService1
{
public void DoWork()
{
}
}
 

Now you can set the binding namespace.

<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
 
That's all.
 
Hope that helps!
add
...