2011-06-21 55 views
-4

可能重复:
WCF Service multiple endpoint configurationWCF多个HTTP/HTTPS端点问题

我有一个WCF服务:

https://myservice/service.svc 
https://myservice/service.svc?wsdl 

下面给出的是我的WCF中的相关章节应用程序的web.config(让我知道你是否需要更多):

<bindings> 
<basicHttpBinding> 
    <binding name="basicHttp"> 
    <security mode="TransportWithMessageCredential"> 
    <message clientCredentialType="UserName"/> 
    </security> 
    </binding> 
</basicHttpBinding> 
</bindings> 

<behaviors> 
<serviceBehaviors> 
    <behavior name="MyService.ServiceBehavior"> 
    <serviceMetadata httpsGetEnabled="true"/> 
    <serviceDebug includeExceptionDetailInFaults="true"/> 
    <serviceCredentials> 
    <userNameAuthentication userNamePasswordValidationMode="MembershipProvider" membershipProviderName="SqlMembershipProvider"/> 
    </serviceCredentials> 
    <serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100"></serviceThrottling> 
    </behavior> 
</serviceBehaviors> 
</behaviors> 

<services> 
<service behaviorConfiguration="MyService.ServiceBehavior" name="MyService.Service"> 
    <endpoint address="/ClientA" binding="basicHttpBinding" bindingConfiguration="basicHttp" name="basicHttpEndpoint" contract="MyService.IService"></endpoint> 
    <endpoint address="/ClientB" binding="basicHttpBinding" bindingConfiguration="basicHttp" name="basicHttpEndpoint" contract="MyService.IService"></endpoint> 
    <endpoint address="/ClientC" binding="basicHttpBinding" bindingConfiguration="basicHttp" name="basicHttpEndpoint" contract="MyService.IService"></endpoint> 
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/> 
</service> 
</services> 

我希望我的客户能够通过以下链接访问服务,但链接不起作用:(或者我的语法对于下面的链接是错误的,请告诉我是否如此)

https://myservice/service.svc/ClientA 
https://myservice/service.svc/ClientB 
https://myservice/service.svc/ClientC 

以下链接工作,但我不认为这是由于我的配置,如果我写的最后向前后,任何削减它仍然工程....

https://myservice/service.svc?wsdl/ClientA 
https://myservice/service.svc?wsdl/ClientB 
https://myservice/service.svc?wsdl/ClientC 

https://myservice/service.svc?wsdl/asfgvafgfgf ... (this works too !!!) 

请让我知道如何做到这一点。我不想为所有客户创建单独的服务。

+0

很抱歉,但我真的坚持了这一点,我需要一些答案,我的线程问题留给回答的海问题,所以再问一次,如果你可以删除最后一个(或者如果你可以告诉我做到这一点的方式)..我会努力去删除那个......但请让这个生活......我需要一些出路... – user402186

回答

0

尝试从端点地址中取出'/'(就像mex端点地址一样)。地址假定相对路径。

在我的示例应用程序,网址看起来像机...

http://localhost:56988/Service1.svc?ClientA 
+0

做到了这一点,dosent工作要么....告诉我一件事,如果删除'/'来测试它是否工作我应该在浏览器中输入什么... https:// myservice/service.svc/ClientA ???我试过了,它没有工作! – user402186

+0

尝试http:// localhost:56988/Service1.svc?vaifhebvifuvb它仍然可以工作... – user402186