开发者

Issue with hosting WCF service in IIS7

开发者 https://www.devze.com 2022-12-23 06:07 出处:网络
I have some issues with hosting a WCF service in IIS. The service was developed in VS2008(C#), and worked well when i hosted it in a console application However when i tried hosting it in IIS, I had i

I have some issues with hosting a WCF service in IIS. The service was developed in VS2008(C#), and worked well when i hosted it in a console application However when i tried hosting it in IIS, I had issues.

Then I created a virtual directory and did the other stuff on IIS manager but came up with this error in my Mozilla browser. Quote: XML Parsing Error: no element found Location: http://localhost/test1/Web.开发者_开发知识库config Line Number 1, Column 1:

I need some help on this guys. Thanks.


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 --> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> 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>
    -->
    <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>

0

精彩评论

暂无评论...
验证码 换一张
取 消