试图从wsdl文件中删除"tempuri"引用.我已经遵循了我能想到的所有现有建议.添加一个
[ServiceBehavior(Namespace="mynamespace")]
Run Code Online (Sandbox Code Playgroud)
属性到实现类,添加一个
[ServiceContract(Namespace="mynamespace")]
Run Code Online (Sandbox Code Playgroud)
到contract接口并更改web.config中端点的"bindingNamespace"属性以匹配.然而,当加载(在IIS中)时,绑定名称空间永远不会被更改..它始终是tempuri.
有没有人有任何其他想法来解决这个问题?下面是来自web配置的示例...绑定名称空间永远不会,无论我做什么,更新为mynamespace,它总是tempuri.org.如果在通过主机工厂加载端点后,我遍历主机描述中的绑定并更新它们,它们将会改变,但这似乎是一个黑客攻击.
对于以下服务:"http://mydomain.com/MyService.svc"以下代表我的终点配置,这甚至被IIS使用?
<services>
<service name="ServiceImplementationClassReference,MyAssembly" >
<endpoint name=""
address="MyService.svc"
binding="basicHttpBinding"
bindingNamespace="mynamespace"
bindingConfiguration=""
contract="IMyContract" />
<endpoint name="mexHttpBinding"
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
Run Code Online (Sandbox Code Playgroud)
关联仍然引用tempuri.org的生成的WSDL文件
<wsdl:import namespace="http://tempuri.org/" location="http://mydomain.org/MyService.svc?wsdl=wsdl0" />
Run Code Online (Sandbox Code Playgroud)
........
<wsdl:service name="Directory">
<wsdl:port name="BasicHttpBinding_IDirectoryServices"
binding="i0:BasicHttpBinding_IDirectoryServices">
<soap:address location="http://mydomain.org/MyService.svc" />
</wsdl:port>
</wsdl:service>
Run Code Online (Sandbox Code Playgroud)
在wsdl:definition节点中,xml名称空间i0(由上面列出的服务引用)也设置为tempuri.org,因此需要import语句.如果我使用BasicHttpBinding或wsHttpBinding,则temprui的使用没有变化.实际上,在web.config文件中设置绑定到wsHttpBinding仍会导致上面的输出,引用BasicHttpBinding_IdirectoryServices.
谢谢!