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

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

(Различия между версиями)
Перейти к: навигация, поиск
Версия 12:08, 11 января 2010 (править)
Dmach (Обсуждение | вклад)
м
← К предыдущему изменению
Версия 12:42, 30 июня 2010 (править) (отменить)
Dmach (Обсуждение | вклад)
м
К следующему изменению →
Строка 1: Строка 1:
-Проблемы с запуском WCF на хостинге обычно от того, что люди забывают дописывать в web.config что-то типа этого:+=== 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"> <serviceHostingEnvironment aspNetCompatibilityEnabled="true">
Строка 7: Строка 15:
</serviceHostingEnvironment> </serviceHostingEnvironment>
-Обычно это имеет смысл при таких ошибках:+=== Could not load type ===
- [ServiceActivationException: The service '/service.svc' cannot be activated due to an exception during compilation.+При работе под ASP.NET версии 4
- 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.]+ 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"
-Но, возможны и другие случаи... 
[[Категория:WEB-сервер IIS]] [[Категория:WEB-сервер IIS]]
[[Категория:Программирование]] [[Категория:Программирование]]
[[Категория:ASP.NET]] [[Категория:ASP.NET]]

Версия 12:42, 30 июня 2010

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

При работе под 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"
Личные инструменты