Mam roztwór z 3 projektów:Hosting WCF Services w ASP.NET MVC projektu
- ConsoleClient (do testowania serwisu WCF)
- ServiceLibrary (dla WCF)
- Web (asp.net mvc projekt)
zrobiłem niektóre ustawienia w moim projekcie ServiceLibrary w app.config
<system.serviceModel>
<services>
<service name="MrDAStoreJobs.ServiceLibrary.AdvertisementService">
<clear />
<endpoint address="http://localhost:8050/ServiceLibrary/basic" binding="basicHttpBinding" bindingConfiguration="" contract="MrDAStoreJobs.ServiceLibrary.Interface.IAdvertisementService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8050/Design_Time_Addresses/MrDAStoreJobs/ServiceLibrary/AdvertisementService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the value below to false before deployment -->
<serviceMetadata httpGetEnabled="True" />
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Kiedy uruchamiam ten projekt, wszystko wydaje się normalnie używać klienta testowego wcf.
Dodałem także WcfDataServiceTest.svc
do mojego hosta Web project(mvc)
do obsługi mojej usługi wcf.
Więc moje pytania to:
- jaka konfiguracja jest potrzebne dla mojego projektu WWW (web.config) faktycznie gospodarza usług wcf?
- A następnie chcę uruchomić aplikację konsolową, aby ją przetestować?
Uwaga: Ja testowałem moją usługę korzystając projekt konsoli ale to był już generację proxy z WCF klienta testowego.
Nawiasem mówiąc, plik wcfDataServiceTest.svc wygląda następująco:
public class WcfDataServiceTest : DataService<AdvertisementService>
{
// This method is called only once to initialize service-wide policies.
public static void InitializeService(DataServiceConfiguration config)
{
// TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
// Examples:
config.SetEntitySetAccessRule("Advertisements", EntitySetRights.AllRead);
// config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
}
}
nie mogę znaleźć ServiceRoute. Ktoś zna przestrzeń nazw? – Rap
Rap, przestrzeń nazw (i dll) dla ServiceRoute to System.ServiceModel.Activation. Będziesz także potrzebować biblioteki System.ServiceModel.Web dla WebServiceHostFactory. –