WCF Barındırma Hizmetleri:Ben 3 proje ile bir çözüm var Asp.Net MVC Projesi
- ConsoleClient (WCF için)
- ServiceLibrary
- Web (asp.net mvc (test WCF hizmeti için) proje)
Ben app.config benim ServiceLibrary projesinde bazı ayarları yapmış
<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>
Bu projeyi çalıştırdığımda, her şey normalde wcf test istemcisi kullanıyor.
Ayrıca, wcf hizmetimi barındırmak üzere Web project(mvc)
numaralı telefonuma WcfDataServiceTest.svc
ekledim.
Yani, sorularım şunlardır:
- Aslında bu wcf hizmeti barındırmak için benim web projesi (web.config) için gereken ne yapılandırma?
- Ve sonra test etmek için konsol uygulamasını çalıştırmak istiyorum?
Not: i konsol projesi kullanarak hizmet test ettik ama bu WCF testi müşteriden vekil nesil başlamıştı. Bu arada
, wcfDataServiceTest.svc dosyası şuna benzer: Benim MVC projesinde doğrudan WCF barındırma hizmeti ediyorum
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;
}
}
Ben ServiceRoute bulamıyorum. İsim alanını bilen var mı? – Rap
Rap, ServiceRoute için ad alanı (ve dll) System.ServiceModel.Activation olduğunu. Ayrıca WebServiceHostFactory için System.ServiceModel.Web dll'ye de ihtiyacınız olacak. –