Iis 7 IIS7中承载WCF服务的问题

Iis 7 IIS7中承载WCF服务的问题,iis-7,Iis 7,我在IIS中托管WCF服务时遇到一些问题。该服务是在VS2008(C#)中开发的,当我在控制台应用程序中托管它时,它运行良好,但是当我尝试在IIS中托管它时,我遇到了问题 然后我创建了一个虚拟目录,并在IIS管理器上执行了其他操作,但在我的Mozilla浏览器中出现了这个错误。 引述: XML分析错误:未找到任何元素 地点: 第1行第1列: 我需要一些帮助。谢谢。 Visual Studio中的Asp.Net配置选项。 可以在中找到设置和注释的完整列表 machine.config.commen

我在IIS中托管WCF服务时遇到一些问题。该服务是在VS2008(C#)中开发的,当我在控制台应用程序中托管它时,它运行良好,但是当我尝试在IIS中托管它时,我遇到了问题

然后我创建了一个虚拟目录,并在IIS管理器上执行了其他操作,但在我的Mozilla浏览器中出现了这个错误。 引述: XML分析错误:未找到任何元素 地点: 第1行第1列:

我需要一些帮助。谢谢。

Visual Studio中的Asp.Net配置选项。 可以在中找到设置和注释的完整列表 machine.config.comments通常位于 \Windows\Microsoft.Net\Framework\v2.x\Config --> 节启用配置 所使用的安全身份验证模式的 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>

-->



您的web.config中似乎有错误,但显示的错误并没有给出太多信息。尝试查看是否所有标记都正确拼写和关闭。谢谢
<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>