Error when publishing services with different namespaces
See original GitHub issueHi, I have encountered the following error in the ?singleWsdl
endpoint when porting some WCF services to .net core using CoreWCF.
An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.NotSupportedException: A single WSDL document could not be generated for this service. Multiple service contract namespaces were found (http://my.company/ws/ServiceB/, http://my.company/ws/ServiceC/, urn:WorkflowWebService). Ensure that all your service contracts have the same namespace.
at CoreWCF.Description.WsdlHelper.VerifyContractNamespace(List`1 wsdls)
at CoreWCF.Description.WsdlHelper.GetSingleWsdl(MetadataSet metadataSet)
at CoreWCF.Description.ServiceMetadataExtension.EnsureSingleWsdlInitialized()
at CoreWCF.Description.ServiceMetadataExtension.get_SingleWsdl()
at CoreWCF.Description.ServiceMetadataExtension.HttpGetImpl.TryHandleMetadataRequestAsync(HttpContext requestContext, IQueryCollection queries)
at CoreWCF.Description.ServiceMetadataExtension.HttpGetImpl.ProcessHttpRequest(HttpContext requestContext)
at CoreWCF.Description.ServiceMetadataExtension.HttpGetImpl.HandleRequest(HttpContext httpContext)
The error shows when invoking the ?singleWsdl endpoint but also there’s something weird when invoking the ?wsdl endpoint, as it shows import directives for types that are not actually needed for the specific service. Everything works fine if I register only one of the services, but I need all of them and they should have different namespaces.
The services are registered as follows:
app.UseServiceModel(wcfBuilder =>
{
wcfBuilder.AddService<MyCompany.ServiceA>((serviceOptions) => { })
.AddServiceEndpoint<MyCompany.ServiceA, MyCompany.IServiceA>(
new CustomBasicHttpsBinding(), "/ws/ServiceA.svc");
wcfBuilder.AddService<MyCompany.ServiceB>((serviceOptions) => { })
.AddServiceEndpoint<MyCompany.ServiceB, MyCompany.ServiceB>(
new CustomBasicHttpsBinding(), "/ws/ServiceB.svc");
wcfBuilder.AddService<MyCompany.ServiceC>((serviceOptions) => { })
.AddServiceEndpoint<MyCompany.ServiceC, MyCompany.ServiceC>(
new CustomBasicHttpsBinding(), "/ws/ServiceC.svc");
});
The services are defined as follows:
[ServiceContractAttribute(Namespace = "urn:WorkflowWebService")]
public interface IServiceA
{
[OperationContract(Action = "", ReplyAction = "*")]
[XmlSerializerFormat(Style = OperationFormatStyle.Rpc, Use = OperationFormatUse.Encoded)]
[return: MessageParameter(Name = "avviaProcessoReturn")]
string avviaProcesso(string in0);
}
public class ServiceA: IServiceA
{
...
}
[ServiceContract(Namespace = "http://my.company/ws/ServiceB/")]
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
public class ServiceB
{
[OperationContract]
public string MyOperation(string request)
{
}
}
[ServiceContract(Namespace = "http://my.company/ws/ServiceC/")]
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
public class ServiceC
{
[OperationContract]
public string MyOperation(string request)
{
}
}
Do you have any suggestion?
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Serialization problem: Different namespaces (.NET)
Here's the problem: The namespace is apparently serialized with the class, so I get the error: Cannot cast NamespaceA.class as NamespaceB.class.
Read more >ServiceAccount authentication from different namespace ...
Nats is running into the nats-io namespace. So one service account called nats-admin-user created in the same namespace. Then other two service ......
Read more >AKS Isolate Service in namespace
We deploy a service to our existing AKS cluster that needs to be isolated as much as possible so it can't access other...
Read more >Kubernetes best practices: Specifying Namespaces in YAML
Namespaces are “hidden” from each other, but they are not fully isolated by default. A service in one Namespace can talk to a...
Read more >Correct "ROS" way to deal with different namespaces for ...
When I listed the topics I saw that the cmd_vel took the namespace of the controller node as in: /diff_drive_controller/cmd_vel Another ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I understand the problem and should have a fix available within a couple of weeks.
I have a PR (#660) out with a fix. It would be helpful if anyone is able to make a local build based off the PR (or just clone my fork and checkout my branch) and test it as an extra verification.