[英]Unable to read WSDL from service
我在IIS中使用SSL证书创建了WCF服务。 我可以看到它的页面,但无法使用它。 如果我想从网站打开wsdl,则什么都不会发生。 当我尝试从客户端创建服务引用时出现错误
元数据包含无法解析的引用:' https://win-1bmal4qsmmk/IPagac/LegalEntityApplicationService.svc?wsdl '。
无法识别文档格式(内容类型为'text / html; charset = UTF-8')。 元数据包含无法解析的引用:' https://win-1bmal4qsmmk/IPagac/LegalEntityApplicationService.svc?wsdl '。 在可以接受该消息的https://win-1bmal4qsmmk/IPagac/LegalEntityApplicationService.svc?wsdl上没有侦听端点。 这通常是由不正确的地址或SOAP操作引起的。 有关更多详细信息,请参见InnerException(如果存在)。 远程服务器返回错误:(404)找不到。 如果服务是在当前解决方案中定义的,请尝试构建解决方案并再次添加服务引用。
web.config文件
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="DPMembershipConnection" connectionString="Data Source=localhost; Initial Catalog=data; Integrated Security=True; Pooling=False" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<roleManager enabled="true" defaultProvider="DPRoleManager">
<providers>
<add name="DPRoleManager" type="System.Web.Security.SqlRoleProvider" connectionStringName="DPMembershipConnection" applicationName="/" />
</providers>
</roleManager>
<authentication mode="Forms" />
<compilation debug="true" targetFramework="4.0" />
<membership defaultProvider="DPMembership">
<providers>
<add applicationName="/" connectionStringName="DPMembershipConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="4" name="DPMembership" passwordStrengthRegularExpression="" type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>
</system.web>
<system.serviceModel>
<bindings>
<ws2007HttpBinding>
<binding name="BindingName">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" />
</security>
</binding>
</ws2007HttpBinding>
</bindings>
<services>
<service name="ApplicationContract.WCFContract.LegalEntityApplicationService">
<endpoint address="https://localhost/IPagac/LegalEntityService.svc"
behaviorConfiguration="NewBehavior0" binding="ws2007HttpBinding"
bindingConfiguration="BindingName" name="Endpoint" contract="ApplicationContract.WCFContract.ILegalEntityApplicationService" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="NewBehavior0" />
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceAuthorization principalPermissionMode="UseAspNetRoles"
roleProviderName="AspNetSqlRoleProvider" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="MembershipProvider"
membershipProviderName="AspNetSqlMembershipProvider" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="false"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
网站根目录中的svc文件
<% @ServiceHost
Debug="true"
Language="C#"
Factory="DP.IPagac.Application.LegalEntityServiceHostFactory"
Service="ApplicationContract.ProgramLayerContract.LegalEntityApplicationService" %>
你对这行有正确的想法
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
但是,除非我错过了任何事情,否则没有向用户提供wsdl的混合端点(由错误指定)。 提供额外的混合端点,例如:
<services>
<service name="ApplicationContract.WCFContract.LegalEntityApplicationService">
<endpoint address="https://localhost/IPagac/LegalEntityService.svc"
behaviorConfiguration="NewBehavior0" binding="ws2007HttpBinding"
bindingConfiguration="BindingName" name="Endpoint"
contract="ApplicationContract.WCFContract.ILegalEntityApplicationService" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.