2011-06-21 52 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