2009-07-25 171 views
0

我正在使用IIS 7.0託管一個簡單的WCF服務。我使用VSTS 2008 + .Net 3.5 + C#編寫它。問題是當我訪問http://localhost:9999/service.svc(我想在web瀏覽器中我們可以瀏覽WSDL的內容,並創建一個使用9999端口並運行管理員帳戶下的應用程序池的新網站),遇到以下錯誤,任何想法是什麼錯誤?IIS託管WCF服務錯誤

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

這裏是我的service.svc:

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

這裏是我的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> 

回答

1

聽起來像.NET 3.0 ISAPI映射消失了。在.NET 3.0 WCF目錄下(C:\ Windows \ Microsoft.NET \ Framework \ v3.0 \ Windows Communication Foundation)運行ServiceModelReg -r

1

請確保您有映射到.svc擴展名ISAPI處理程序。

+0

謝謝,如果我需要從瀏覽器訪問WSDL文件,我需要訪問.svc文件? – George2 2009-07-25 05:42:49

+1

是的,要獲得WSDL,您需要點擊該服務(訪問.svc)文件,然後服務主機類將從其服務描述中組裝WSDL。 – 2009-07-25 09:04:42