2010-03-16 55 views
0

我在IIS中託管WCF服務時遇到了一些問題。該服務是在VS2008(C#)中開發的,並且在我將其託管在控制檯應用程序中時運行良好。但是,當我嘗試在IIS中託管它時,我遇到了問題。在IIS7中託管WCF服務的問題

然後我創建了一個虛擬目錄,並在IIS管理器上做了其他的東西,但在我的Mozilla瀏覽器中出現了這個錯誤。 報價: XML解析錯誤:沒有的元素中找到 地點:http://localhost/test1/Web.config 1號線,1列:

我需要這個傢伙的一些幫助。謝謝。

+0

似乎有在你的web.config一個錯誤,但顯示沒有給出太多信息的錯誤。試着看看是否所有的標籤拼寫正確並關閉。謝謝 – 2010-03-16 15:18:53

+0

所有標籤都已關閉 – Wilson 2010-03-16 15:32:08

回答

1

Visual Studio中的Asp.Net配置選項。 的設置和註釋的完整列表可在 machine.config.comments通常位於 \的Windows \ Microsoft.Net \框架\ V2.X \配置 中找到 - > 部分使使用 ASP.NET來識別傳入的用戶的安全身份驗證模式的配置 。 - > 部分啓用配置 如果/在執行請求期間發生未處理的錯誤 時該怎麼辦。具體而言, 它使開發人員能夠配置html錯誤頁面 以代替錯誤堆棧跟蹤進行顯示。

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> 
     <error statusCode="403" redirect="NoAccess.htm" /> 
     <error statusCode="404" redirect="FileNotFound.htm" /> 
    </customErrors> 
    --> 
    <pages> 
     <controls> 
      <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     </controls> 
    </pages> 
    <httpHandlers> 
     <remove verb="*" path="*.svc" /> 
    <add path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false"/> 

     <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="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
      <providerOption name="CompilerVersion" value="v3.5" /> 
      <providerOption name="WarnAsError" value="false" /> 
     </compiler> 
    </compilers> 
</system.codedom> 
<system.web.extensions> 
    <scripting> 
     <webServices> 
      <!-- 
      Uncomment this section to enable the authentication service. Include 
      requireSSL="true" if appropriate. 

     <authenticationService enabled="true" requireSSL = "true|false"/> 
     --> 
      <!-- 
      Uncomment these lines to enable the profile service, and to choose the 
      profile properties that can be retrieved and modified in ASP.NET AJAX 
      applications. 

     <profileService enabled="true" 
         readAccessProperties="propertyname1,propertyname2" 
         writeAccessProperties="propertyname1,propertyname2" /> 
     --> 
      <!-- 
      Uncomment this section to enable the role service. 

     <roleService enabled="true"/> 
     --> 
     </webServices> 
     <!-- 
    <scriptResourceHandler enableCompression="true" enableCaching="true" /> 
    --> 
    </scripting> 
</system.web.extensions> 
<!-- 
    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> 
    <directoryBrowse enabled="true" /> 
</system.webServer> 

<services> 

    <service name="SendMsg.Service1" behaviorConfiguration="SendMsg.Service1Behavior"> 
    <endpoint address="http://192.168.1.20:803/Service1.svc" binding="basicHttpBinding" contract="SendMsg.IService1" /> 
    <host> 
     <baseAddresses> 
     <add baseAddress="http://192.168.1.20:803"/> 
     </baseAddresses> 
    </host> 

    <!--<endpoint address="net.tcp://localhost:8080/MyService/MathService.svc" 
    contract="IMathService" 
       binding="netTcpBinding"/>--> 
    </service> 
</services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="SendMsg.Service1Behavior"> 
     <serviceMetadata httpGetEnabled="True" /> 
     <serviceDebug includeExceptionDetailInFaults="true" /> 
    </behavior> 
    </serviceBehaviors> 
</behaviors>