tags:

views:

36

answers:

1

Hey, here is my Web.config file. Everything works for my services except Service1/help.

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <customErrors mode="Off"/>
  </system.web>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="UrlRoutingModule"/>
      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </modules>
    <handlers>
      <add
        name="UrlRoutingHandler"
        preCondition="integratedMode"
        verb="*" path="UrlRouting.axd"
        type="System.Web.HttpForbiddenHandler, System.Web,  &#xD;&#xA;          Version=2.0.0.0, Culture=neutral,  &#xD;&#xA;          PublicKeyToken=b03f5f7f11d50a3a"
       />
    </handlers>
  </system.webServer>
  <system.serviceModel>

    <bindings>
      <webHttpBinding>
        <binding name="SSLBinding">
          <security mode="Transport">
            <transport clientCredentialType="Certificate" proxyCredentialType="None" />
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="sBehavior">
          <routing routeOnHeadersOnly="true" />
          <serviceMetadata httpsGetEnabled="true" httpsGetBinding="webHttpBinding" httpsGetBindingConfiguration="" />
        </behavior>
      </serviceBehaviors>
    </behaviors>



    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>

    <standardEndpoints>
      <webHttpEndpoint>
        <standardEndpoint name="Default" helpEnabled="true" automaticFormatSelectionEnabled="true">
          <security mode="Transport">
            <transport clientCredentialType="Certificate"/>
          </security>          
        </standardEndpoint>
      </webHttpEndpoint>
    </standardEndpoints>    

  </system.serviceModel>

</configuration>

Services:

namespace UserWebServices
{
    // Start the service and browse to http://&lt;machine_name&gt;:&lt;port&gt;/Service1/help to view the service's generated help page
    // NOTE: By default, a new instance of the service is created for each call; change the InstanceContextMode to Single if you want
    // a single instance of the service to process all calls.   
    [ServiceContract]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
    // NOTE: If the service is renamed, remember to update the global.asax.cs file
    public class Service1
    {
        // TODO: Implement the collection resource that will contain the SampleItem instances

        [WebGet(UriTemplate = "")]
        public List<SampleItem> GetCollection()
        {
            // TODO: Replace the current implementation to return a collection of SampleItem instances
            return new List<SampleItem>() { new SampleItem() { Id = 1, StringValue = "Kader" },
                                            new SampleItem() { Id = 2, StringValue = "Weber" }};
        }

        [WebGet(UriTemplate = "{id}")]
        public SampleItem Get(string id)
        {
            int idConverted = Convert.ToInt32(id);

            return new SampleItem() { Id = idConverted, StringValue = "SingleItem" };        
        }

        [WebInvoke(UriTemplate = "", Method = "POST")]        
        public SampleItem Create(SampleItem instance)
        {
            if (instance == null)
                throw new NoNullAllowedException();

            return instance;
        }        

        [WebInvoke(UriTemplate = "{id}", Method = "PUT")]
        public SampleItem Update(string id, SampleItem instance)
        {
            int idConverted = Convert.ToInt32(id);

            return new SampleItem() { Id = idConverted, StringValue = "Putted" };        
        }

        [WebInvoke(UriTemplate = "{id}", Method = "DELETE")]
        public void Delete(string id)
        {
            // TODO: Remove the instance of SampleItem with the given id from the collection
            throw new NotImplementedException();
        }
    }
}
A: 

Enable Tracing, this will really help identifying any possible issues encountered when working with WCF. See http://msdn.microsoft.com/en-us/library/ms733025.aspx.

Also, use: \Program Files\Microsoft SDKs\Windows\v6.0A\Bin\SvcTraceViewer.exe.

Maxime