Używam VSTS 2008 + C# + .NET 3.0. Używam samodzielnie hostowanej usługi WCF. Podczas wykonywania poniższej instrukcji występuje następujący błąd "nie znaleziono powiązania". Wysłałem cały mój plik app.config, jakieś pomysły, co jest nie tak?Błąd wiązania mex w WCF
ServiceHost host = new ServiceHost(typeof(MyWCFService));
Komunikat o błędzie:
nie można odnaleźć adres bazowy, który pasuje do schematu http dla końcowego z obowiązującymi MetadataExchangeHttpBinding. Zarejestrowane schematy adresów to [https].
Pełna app.config:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="MyBinding"
closeTimeout="00:00:10"
openTimeout="00:00:20"
receiveTimeout="00:00:30"
sendTimeout="00:00:40"
bypassProxyOnLocal="false"
transactionFlow="false"
hostNameComparisonMode="WeakWildcard"
maxReceivedMessageSize="100000000"
messageEncoding="Mtom"
proxyAddress="http://foo/bar"
textEncoding="utf-16"
useDefaultWebProxy="false">
<reliableSession ordered="false"
inactivityTimeout="00:02:00"
enabled="true" />
<security mode="Transport">
<transport clientCredentialType="Digest"
proxyCredentialType="None"
realm="someRealm" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="MyWCFService"
behaviorConfiguration="mexServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="https://localhost:9090/MyService"/>
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="MyBinding" contract="IMyService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="mexServiceBehavior">
<serviceMetadata httpGetEnabled="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
Czy to możliwe, aby mieć IMetadataExchange zarówno http i https jako oddzielne punkty końcowe? Co należy im zająć? –
Moje pytanie dotyczyło http: i https, a nie protokołu net.tcp. –
@MichaelFreidgeim: przepraszam - źle odczytałem. Ale to samo dotyczy: powinieneś być w stanie zdefiniować drugi adres bazowy dla 'http: //' i użyć go dla http mex punktu końcowego. –