WCF сервис - не работает

Материал из 1GbWiki.

Перейти к: навигация, поиск

[править] ServiceActivationException

При ошибках вида

[ServiceActivationException: The service '/service.svc' cannot be activated due to an exception during compilation.
The exception message is: This collection already contains an address with scheme http.  There can be at most one 
address per scheme in this collection. Parameter name: item.]

Нужно дописать что-то типа

<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
  <baseAddressPrefixFilters>
    <add prefix="http://dmach.ru/"/>
  </baseAddressPrefixFilters>
</serviceHostingEnvironment>

[править] Could not load type 'System.ServiceModel'

При работе под ASP.NET версии 4

Could not load type 'System.ServiceModel.Activation.HttpHandler' from assembly 'System.ServiceModel, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Нужно убрать из web.config следующее:

aspNetCompatibilityEnabled="true"
Личные инструменты