Reputation: 1964
Allmost all day today I am trying to research on WCF and one of my aim was to create a WCF service manually (or almost so).
Based on few articles on web on how to structure WCF application I have created contracts project which contain service interfaces and implementation project. Both have Runtime.Serialization
I have created app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="FulFillmentServiceBehaviour">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="FulFillmentServiceBehaviour"
name="Project.Services.Fulfillment">
<endpoint address="http://localhost:8080/Services" binding="basicHttpBinding"
bindingConfiguration="" contract="P.Infrastructure.Services.IFulfillment" />
<endpoint binding="mexHttpBinding" bindingConfiguration="" />
</service>
</services>
</system.serviceModel>
</configuration>
1) How can I host this service in IIS I already created virtual directory pointing to folder containing project Services (url http://localhost:8080/Services)
2) How to create wsdl file so that I can use SOAPUI to test it
I tried adding a file "fulfillment.svc" with markup
<%@ ServiceHost Language="C#" Debug="true" Service="Project.Services.Fulfillment" CodeBehind="Fulfillment.cs" %>
for the purpose of testing but it gave error
The type Project.Services.Fulfillment', provided as the Service attribute value in the ServiceHost directive could not be found.
Update 1******
just found this on net - may be this will help. one imp ino is that i will need web.config
http://wncadmb026d.na-idm.na-gad.nec.com/Services/Fulfillment.svc?wsdl
Update 2:*****
SOAP UI is able to generate SOAP request but gers http 404 as response...
Upvotes: 1
Views: 2098
Reputation: 1964
I was able to get the basic service up with help from http://www.aspfree.com/c/a/ASP.NET/Developing-a-WCF-Service-Library-and-Hosting-it-as-WCF-Web-Service-Using-VS2K8/
and
http://msdn.microsoft.com/en-us/library/ms733766(v=VS.90).aspx
I copied service model section from app.congig to web.config
I also had to chaNGE BUILD FOLDER TO /BIN Instead of /bin/debug/
will add more code tomorrow morning
Upvotes: 1
Reputation: 7499
For WSDL page you have the correct attribute:
<serviceMetadata httpGetEnabled="true" />
And you can access it by adding ?wsdl to the URL, ie http://localhost:8080/Service.svc?wsdl
As for the error, I think the problem is that you are not using the .svc extension:
<%@ ServiceHost Language="C#" Debug="true"
Service="Project.Services.Fulfillment" CodeBehind="Fulfillment.svc.cs" %>
You are using a .svc file, right?
If you are not using an .svc file one thing to do is use routing, see this link for an example: http://geekswithblogs.net/michelotti/archive/2010/08/21/restful-wcf-services-with-no-svc-file-and-no-config.aspx
Upvotes: 0