[英]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.