远程服务器的WCF服务代理创建错误

时间:2013-04-24 07:57:59

标签: c# wcf iis

我在使用Visual Studio 2008的Windows XP计算机中托管了WCF服务。当我尝试从本地计算机浏览wcf服务时,它表现得非常好。当我尝试将wcfservice引用添加到同一LAN连接中的另一台机器中的应用程序时,WCF页面正常打开但是wcf?wsdl抛出错误:

url xxx.xxx.xxx.xxx/WcfGenericService/GenericService.svc上的文档未被识别为已知文档类型。 每种已知类型的错误消息可以帮助您解决问题: - 来自'DISCO Document'的报告是'下载'错误'er01dsk40612560.cmcportal.com/WcfGenericService/GenericService.svc?disco'。'。    - 请求失败,HTTP状态为404:未找到。 - 来自'WSDL文档'的报告是'文档格式无法识别(内容类型为'text / html; charset = UTF-8')。'。 - 来自'xxx.xxx.xxx.xxx/WcfGenericService/GenericService.svc'的报告是'无法识别文档格式(内容类型为'text / html; charset = UTF-8')。'。 - 来自'XML Schema'的报告是'文档格式无法识别(内容类型为'text / html; charset = UTF-8')。'。 元数据包含无法解析的引用:'xxx.xxx.xxx.xxx/WcfGenericService/GenericService.svc'。 内容类型application / soap + xml;服务xxx.xxx.xxx.xxx/WcfGenericService/GenericService.svc不支持charset = utf-8。客户端和服务绑定可能不匹配。 远程服务器返回错误:(415)无法处理消息,因为内容类型为'application / soap + xml; charset = utf-8'不是预期的类型'text / xml;字符集= UTF-8' .. 如果在当前解决方案中定义了服务,请尝试构建解决方案并再次添加服务引用。“

托管在同一台机器上的其他WCF服务,比如我正在谈论的WCF服务,运行完美。为了您的参考,我附上了所述WCF服务的web.config

<?xml version="1.0"?>
<configuration>
  <configSections>
    <!--STARTWORKFLOW-->
    <section name="WorkflowRuntime" type="System.Workflow.Runtime.Configuration.WorkflowRuntimeSection, System.Workflow.Runtime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <section name="WorkflowRuntimeConfig" type="System.Workflow.Runtime.Configuration.WorkflowRuntimeSection, System.Workflow.Runtime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <!--ENDWORKFLOW-->
    <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>
    <add key="EnvType" value="UAT" />
    <add key="con" value="Password=cnfg;User ID=cnfg;Data Source=conf; max pool size=1"/>
    <!--SA v4.16.0.0-->
    <add key="maxpool" value="100"></add>
    <!--EA v4.16.0.0-->
    <!-- STARTWORKFLOW -->
    <add key="UWCustomWorkflowForAll" value="0"></add>
    <add key="UWClsRequestObjectStatus" value="0"></add>
    <add key="ClaimProcessingThruWF" value="1"></add>
    <add key="ClaimApprovalThruWF" value="1"></add>
    <add key="ApprovalCondition" value="1"></add>
    <!-- ENDWORKFLOW -->
    <!--valid values GenRemote,WcfLocal,WcfRemote-->
    <add key="MailSMSServerType" value="WcfLocal"/>
    <!--valid values GenRemote,WcfLocal,WcfRemote-->
    <add key="ServicePath" value=""/>
    <add key="systemMailSender" value="abcinsuranceonline@cmcltd.com"/>
    <add key="systemMailServer" value="172.16.11.11"/>
    <add key="systemSMSServer" value="209.160.65.107"/>
    <add key="systemSMSUserID" value="cmc"/>
    <add key="systemSMSUserPWD" value="cmc567"/>
    <add key="UseEncryptedPassword" value="N"></add>
    <add key="Secretkey1" value="fgfgfgkk"></add>
    <add key="Secretkey2" value="ylkghjfr"></add>
    <add key="ConPwdServiceURL" value=""/>
    <add key="Secretfilepath" value="C:\GenisysPassword.txt"></add>
    <add key="SecretkeyDefualt1" value="fgfgfgkk"></add>
    <add key="SecretkeyDefualt2" value="ylkghjfr"></add>
    <add key="SecretfilepathDefualt" value="C:\GenisysDefaultPassword.txt"></add>
    <add key="EscalationMailSender" value="abcinsuranceonline@cmcltd.com" />
    <add key="ClusterSize" value="*" />
    <!--SA v4.16.0.0 key must be of exact 8 characters-->
    <!--Note: changing key will invalidate running batch jobs.-->
    <!--Note: After key change batch must be re-registered.-->
    <add key="BatchSecretKey1" value="s!a^lo1~"/>
    <!--EA v4.16.0.0 key must be of exact 8 characters-->
    <!--Changes made on 15072009 V4.16.0.0(36088)-->
    <add key="ExceptionSystem" value="Y"/>
    <!--Changes made on 15072009 V4.16.0.0(36088)-->

    <!-- Start: added By Dipen 22/12/2009 For GenericServiceBL(AuthenticationBL.vb) to implement timeout for authenticated user LoggedUserTimeOut-->
    <add key="LoggedUserTimeOut" value="1440"/>
    <!--End: -->
  </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>
        <!--STARTWORKFLOW-->
        <add assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Workflow.Runtime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <!--ENDWORKFLOW-->
        <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"/>
    <!--
            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>
    <services>
      <service behaviorConfiguration="WcfGenericService.Service1Behavior" name="WcfGenericService.GenericService">
        <!--
        <endpoint address="net.tcp://xxx.xxx.xxx.xxx/WcfGenConfService/GenConfService.svc" binding="netTcpBinding" bindingConfiguration="EndPointHTTPGen"
          name="EndPointTCP" contract="WcfGenConfService.IGenConfService" >
        </endpoint>
        -->
        <endpoint address="" binding="basicHttpBinding" name="EndPointHTTPGeneric" contract="WcfGenericService.IGenericService" bindingConfiguration ="EndPointHTTPGeneric">
          <identity>
            <dns  value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WcfGenericService.Service1Behavior" >
          <!-- 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>
    <!--SA arun for sending mail/sms thru remote WcfGenConfService-->
    <bindings>
      <basicHttpBinding>
        <binding name="EndPointHTTPGeneric" closeTimeout="00:01:00" openTimeout="00:01:00"
            receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
            bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
            maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
            useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="xxx.xxx.xxx.xxx/WcfGenericService/GenericService.svc"
          binding="basicHttpBinding" bindingConfiguration="EndPointHTTPGeneric"
          contract="GenericService.IGenericService" name="EndPointHTTPGeneric" />
    </client>
    <!--SA arun for sending mail/sms thru remote WcfGenConfService-->
  </system.serviceModel>

  <!--STARTWORKFLOW-->
  <WorkflowRuntime Name="WorkflowServiceContainer">
    <Services>
      <add type="System.Workflow.Runtime.Hosting.ManualWorkflowSchedulerService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" useActiveTimers="true"/>
      <!--<add type="System.Workflow.Runtime.Hosting.DefaultWorkflowTransactionService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>-->
      <add type="System.Workflow.Activities.ExternalDataExchangeService, System.Workflow.Activities, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </Services>
  </WorkflowRuntime>
  <WorkflowRuntimeConfig>
    <Services>
      <!--v4.24.0.0 useActiveTimers added as per Microsoft Recommendation-->
      <add type="System.Workflow.Runtime.Hosting.ManualWorkflowSchedulerService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" useActiveTimers="true" />
      <add type="System.Workflow.Activities.ExternalDataExchangeService, System.Workflow.Activities, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </Services>
  </WorkflowRuntimeConfig>
  <!--ENDWORKFLOW-->

</configuration>

你能告诉我如何解决这个问题吗?提前致谢。

0 个答案:

没有答案