tags:

views:

103

answers:

2

Hello everyone,

I am using IIS 7.0 to host a simple WCF service. I write it by using VSTS 2008 + .Net 3.5 + C#. The issue is when I access http://localhost:9999/service.svc (I suppose in web browser we can browse the content of WSDL, and I create a new web site which uses port 9999 and run application pool under administrator account), but met with the following error, any ideas what is wrong?

http://i27.tinypic.com/a9r8cz.jpg

Here is my service.svc,

<%@ ServiceHost Language="C#" Service="Gu.WCF.StudentManagement" %>

Here is my web.config,

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="Gu.WCF.ServiceBehavior"
        name="Gu.WCF.StudentManagement">
        <endpoint address="" binding="basicHttpBinding" contract="Gu.WCF.IStudentManagement">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Gu.WCF.ServiceBehavior">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above 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>
</configuration>

thanks in advance, George

+1  A: 

Please make sure that you have the .svc extension mapped to the ISAPI handler.

REA_ANDREW
Thanks, if I need to access WSDL file from browser, I need to access the .svc file?
George2
Yes, to get the WSDL, you will need to hit the service (access the .svc) file and the service host class will then assemble the WSDL from its service description.
marc_s
Thanks Marc, my issue is solved by using ServiceModelReg -r.
George2
+1  A: 

Sounds like the .NET 3.0 ISAPI mappings have vanished. In the .NET 3.0 WCF directory (C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation) run ServiceModelReg -r

blowdart
Works, cool! :-)
George2