c# - Host WCF in IIS -
hello smart people.
so, i've dared make myself wcf-service. works should, when run in wcf testing utility.
but next step i've run troubles. hosting wcf-service in iis.
as said, service works test utility.
my solution:
for hosting service in iis created folder called "hostiistcp" can see in solution, added dll's , pdb's under "bin" folder. can understand, iis cannot operate app.config file created web.config file, copy/pasted app.config file in class library.
the web.config :
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <compilation debug="true" /> </system.web> <system.servicemodel> <services> <service name="mywcfservices.realkursusservice.kursistservice"> <endpoint address="" binding="basichttpbinding" contract="mywcfservices.realkursusservice.ikursistservice"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexhttpbinding" contract="imetadataexchange" /> <host> <baseaddresses> <add baseaddress="http://localhost:8080/mywcfservices/realkursusservice/kursistservice/" /> </baseaddresses> </host> </service> </services> <behaviors> <servicebehaviors> <behavior> <servicemetadata httpgetenabled="true"/> <servicedebug includeexceptiondetailinfaults="false" /> </behavior> </servicebehaviors> </behaviors> </system.servicemodel> </configuration>
i believe problem lays web.config file, , pardon me being newbie @ this, i've been googling crazy , cant find proper solution.
to sum up: on right track? there (better) solution hosting wcf-services in iis? , if point out if missing in web.config file great.
i'm using visual studio 2012, iis 8 .net framework 4.5 , sitting in leather-chair.
so figured out.
by way, sorry vauge question, pretty confuesd why wcf service wouldnt hosted.
i got web.config working following steps:
- "add new website" solution (wcf-service)
- delete 2 servicefiles (service.cs, iservice.cs) because i'v allready services defined in other service library.
- add reference exsisting service-librarys.
edit service.svc file in newly created website, point @ exsisting service service
<%@ servicehost language="c#" debug="true" service="mywcfservices.realkursusservice.kursistservice" %>
deleted whole config in web.config on new site.
- edit web.config "wcf configuration" tool (right click on web.config file) when using wcf configuration tool it's pretty straight forward. add service , point reference dll in bin directory.
then hosted svc file in new application under default site in iis
hope can
Comments
Post a Comment