2011-06-23 109 views
1

我一直在試圖解決這個問題近2天,似乎沒有取得很大進展。我有一個WCF服務(在VWD2008中用VB開發)。在本地運行時,我可以通過指向WSDL頁面的鏈接查看標準的.svc幫助頁面。WCF/SSL返回IIS7中的空白頁

我把它移到了一個服務器,並在嘗試加密之前重新測試 - 仍然可以正常工作。

然後我建立了自簽名證書,這是問題似乎開始的地方。我知道我的服務器和我的電腦之間的證書認證正常(客戶端證書在IIS7上設置爲必需),因爲我可以在使用https時訪問簡單的.aspx頁面。在這個階段,當我嘗試瀏覽到的.svc第2點的事情發生 - 在IE中一個空白頁將被返回,並在FF我收到以下消息黃色背景

XML Parsing Error: no element found 

Location: https://www.database-direct.com/vs.svc 

Line Number 1, Column 1: 

從我已經讀過,區別僅在於FF處理空白頁的方式不同。

我很確定我的web.config文件是正確的,因爲它幾乎是成功運行的其他服務的副本(儘管在運行IIS6的不同服務器上 - 配置文件中是否有任何區別? )

<?xml version="1.0"?> 

<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use 
    the Website->Asp.Net Configuration option in Visual Studio. 
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
--> 
<configuration> 
    <configSections> 
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
     <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
     <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
     <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
      <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/> 
      <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
      <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
      <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
     </sectionGroup> 
     </sectionGroup> 
    </sectionGroup> 
    </configSections> 
    <appSettings/> 
    <connectionStrings /> 
    <system.web> 
    <!-- 
      Set compilation debug="true" to insert debugging 
      symbols into the compiled page. Because this 
      affects performance, set this value to true only 
      during development. 

      Visual Basic options: 
      Set strict="true" to disallow all data type conversions 
      where data loss can occur. 
      Set explicit="true" to force declaration of all variables. 
     --> 
    <compilation debug="true" strict="false" explicit="true"> 
     <assemblies> 
     <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
     <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     </assemblies> 
    </compilation> 
    <pages> 
     <namespaces> 
     <clear/> 
     <add namespace="System"/> 
     <add namespace="System.Collections"/> 
     <add namespace="System.Collections.Specialized"/> 
     <add namespace="System.Configuration"/> 
     <add namespace="System.Text"/> 
     <add namespace="System.Text.RegularExpressions"/> 
     <add namespace="System.Linq"/> 
     <add namespace="System.Web"/> 
     <add namespace="System.Web.Caching"/> 
     <add namespace="System.Web.SessionState"/> 
     <add namespace="System.Web.Security"/> 
     <add namespace="System.Web.Profile"/> 
     <add namespace="System.Web.UI"/> 
     <add namespace="System.Web.UI.WebControls"/> 
     <add namespace="System.Web.UI.WebControls.WebParts"/> 
     <add namespace="System.Web.UI.HtmlControls"/> 
     </namespaces> 
     <controls> 
     <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     </controls> 
    </pages> 
    <!-- 
      The <authentication> section enables configuration 
      of the security authentication mode used by 
      ASP.NET to identify an incoming user. 
     --> 
    <authentication mode="Windows"/> 
    <customErrors mode="Off"/> 
    <!-- 
      The <customErrors> section enables configuration 
      of what to do if/when an unhandled error occurs 
      during the execution of a request. Specifically, 
      it enables developers to configure html error pages 
      to be displayed in place of a error stack trace. 

     <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> 
      <error statusCode="403" redirect="NoAccess.htm" /> 
      <error statusCode="404" redirect="FileNotFound.htm" /> 
     </customErrors> 
     --> 
    <httpHandlers> 
     <remove verb="*" path="*.asmx"/> 
     <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> 
    </httpHandlers> 
    <httpModules> 
     <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
    </httpModules> 
    </system.web> 
    <system.codedom> 
    <compilers> 
     <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
     <providerOption name="CompilerVersion" value="v3.5"/> 
     <providerOption name="OptionInfer" value="true"/> 
     <providerOption name="WarnAsError" value="false"/> 
     </compiler> 
    </compilers> 
    </system.codedom> 
    <!-- 
     The system.webServer section is required for running ASP.NET AJAX under Internet 
     Information Services 7.0. It is not necessary for previous version of IIS. 
    --> 
    <system.webServer> 
    <validation validateIntegratedModeConfiguration="false"/> 
    <modules> 
     <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
    </modules> 
    <handlers> 
     <remove name="WebServiceHandlerFactory-Integrated"/> 
     <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
    </handlers> 
    </system.webServer> 
    <system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="wsHttpEndpointBinding"> 
      <security mode="Transport"> 
      <transport clientCredentialType="Certificate"/> 
      <message clientCredentialType="None"/> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <services> 
     <service behaviorConfiguration="VSco.VSBehavior" name="VSco.VS"> 
     <endpoint address="https://www.url.com/VS.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding" name="wsHttpEndPoint" contract="VSco.IVS"/> 
     <endpoint address="mex" binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding" name="mexEndpoint" contract="IMetadataExchange"/> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="VSco.VSBehavior"> 
      <serviceCredentials> 
      <serviceCertificate findValue="client" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName"/> 
      </serviceCredentials> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="false" httpsGetEnabled="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="true"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 
</configuration> 

從我已經從尋找到這個看,它會建議某種IIS的設置問題,我認爲,作爲實際的服務似乎工作確定。我能想到的唯一的另一件事來檢查是處理程序映射,但他們檢查了OK - svc-ISAPI-2.0-64映射對*.svc

如果任何人有任何進一步的建議,我怎麼能調試這(我已經使用Fiddler檢查,很簡單地獲得頁面加載狀態200)或可能導致它我會非常感激!

+0

你最終解決了這個問題嗎? – John

回答

1

我剛剛有這個問題。我認爲是因爲在IIS中MIME映射中缺少svc。

爲了解決此問題,您需要運行「\%windir%\ Microsoft.NET \ Framework \ v3.0 \ Windows Communication Foundation \ ServiceModelReg.exe -i」。它會創建所需的.svc映射。

如果你在64位,它的Framework64

+0

感謝您的回答 - 我將有機會在本週晚些時候進行測試,並會回覆您。 – allanmayberry88

+0

不幸的是,這對我來說沒有什麼不同 – allanmayberry88

+0

我跑了這個相同的聲明,並沒有爲我解決這個問題。我爲Framework 64和x86運行了這個,沒有運氣 –