Reputation: 181
Hello all you smart people.
So, I've dared to make myself a WCF-service. It works as is should, when i run it in the WCF testing utility.
But with the next step I've run into some troubles. Hosting the WCF-service in IIS.
As said, the service works with the test utility.
My solution:
For hosting my service in IIS i created a folder called "HostIISTcp" as you can see in the solution, where i added my dll's and my pdb's under the "bin" folder. As i can understand, IIS cannot operate with an app.config file so i created a web.config file, where i simply copy/pasted from the app.config file in the 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 that the problem lays with the web.config file, and pardon me for being a newbie at this, but I've been googling like a crazy and i really cant find a proper solution.
To sum up: Am I on the right track? Are there another (better) solution for hosting wcf-services in IIS? And if you could point out if anything is missing in the web.config file it would be great.
I'm using visual studio 2012, IIS 8 .net framework 4.5 and sitting in a leather-chair.
Upvotes: 0
Views: 7958
Reputation: 181
So i figured it out.
By the way, sorry for the vauge question, i was pretty confuesd why my wcf service wouldnt be hosted.
I got the web.config working by with the following steps:
Edit the service.svc file in my newly created website, to point at my exsisting service service
<%@ ServiceHost Language="C#" Debug="true" Service="MyWCFServices.RealKursusService.KursistService" %>
Deleted the whole config in web.config on my new site.
Then hosted the svc file in a new application under my default site in iis
Hope this can help someone
Upvotes: 2