У меня толстый клиент, который открывает каналы на нескольких сервисах WCF.Сервисы создаются с использованием C #, WCF, nHibernate, Fluent и Unity (ServiceHostFactory).
Когда я пытаюсь получить доступ к MetaData для Plate.svc через браузер, я получаю 400 неверных запросов, которые не генерируют операторов журнала, хотяхорошие запросы из приложения делают.Все запросы из приложения работают нормально.
Есть идеи?
Я включил важные биты следующих файлов:
- Сервисная разметка
- Сервисный контракт
- Сервис Web.config
- Клиентский App.config
1. Разметка сервиса
ServiceHost Language = "C #" Отладка= "true" Service = "PRO.Services.PlateService" CodeBehind = "Plate.svc.cs" Factory = "PRO.Services.Configuration.UnityServiceHostFactory"
2. Договор на обслуживание
namespace PRO.ServiceContracts {
[ServiceContract]
public interface IPlateService {
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest)]
[FaultContract(typeof(string))]
AnalysisPlate Search(string barcode);
// identically defined operations removed
}
}
3. Сервис Web.config
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpEndpointBinding">
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ProBehavior">
<serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<services>
<service behaviorConfiguration="ProBehavior" name="PRO.Services.PlateService">
<endpoint address="" contract="PRO.ServiceContracts.IPlateService"
binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpointBinding"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="ProBehavior" name="PRO.Services.SampleService">
<endpoint address="" contract="PRO.ServiceContracts.ISampleService"
binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpointBinding"/>
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</modules>
</system.webServer>
4. Клиентское приложение.config
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_Normal">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:4829/Sample.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Normal" contract="PRO.ServiceContracts.ISampleService" name="DEV_ISampleService" />
<endpoint address="http://localhost:4829/Plate.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Normal" contract="PRO.ServiceContracts.IPlateService" name="DEV_IPlateService" />
</client>
</system.serviceModel>