• ServiceMetadataBehavior 的 HttpsGetEnabled 属性设置为 True,而 HttpsGetUrl 属性是相对地址,但没有 https 基址


    WCF 发布,本机正常,服务器报错,信息如下:
    
    ServiceMetadataBehavior 的 HttpsGetEnabled 属性设置为 True,而 HttpsGetUrl 属性是相对地址,但没有 https 基址。请提供 https 基址或将 HttpsGetUrl 设置为绝对地址。
    
    说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 
    
    异常详细信息: System.InvalidOperationException: ServiceMetadataBehavior 的 HttpsGetEnabled 属性设置为 True,而 HttpsGetUrl 属性是相对地址,但没有 https 基址。请提供 https 基址或将 HttpsGetUrl 设置为绝对地址。
    
    源错误: 
    
    执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。
    
    堆栈跟踪: 
    
    
    [InvalidOperationException: ServiceMetadataBehavior 的 HttpsGetEnabled 属性设置为 True,而 HttpsGetUrl 属性是相对地址,但没有 https 基址。请提供 https 基址或将 HttpsGetUrl 设置为绝对地址。]
       System.ServiceModel.Description.ServiceMetadataBehavior.EnsureGetDispatcher(ServiceHostBase host, ServiceMetadataExtension mex, Uri url, String scheme) +5330817
       System.ServiceModel.Description.ServiceMetadataBehavior.CreateHttpGetEndpoints(ServiceDescription description, ServiceHostBase host, ServiceMetadataExtension mex) +89
       System.ServiceModel.Description.ServiceMetadataBehavior.ApplyBehavior(ServiceDescription description, ServiceHostBase host) +61
       System.ServiceModel.Description.ServiceMetadataBehavior.System.ServiceModel.Description.IServiceBehavior.ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase) +30
       System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost) +3276
       System.ServiceModel.ServiceHostBase.InitializeRuntime() +60
       System.ServiceModel.ServiceHostBase.OnBeginOpen() +27
       System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) +50
       System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +318
       System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +206
       System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +651
    
    [ServiceActivationException: 由于编译过程中出现异常,无法激活服务“/Rights/RightService.svc”。异常消息为: ServiceMetadataBehavior 的 HttpsGetEnabled 属性设置为 True,而 HttpsGetUrl 属性是相对地址,但没有 https 基址。请提供 https 基址或将 HttpsGetUrl 设置为绝对地址。。]
       System.Runtime.AsyncResult.End(IAsyncResult result) +688590
       System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +190
       System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, String routeServiceVirtualPath, Boolean flowContext, Boolean ensureWFService) +234
       System.ServiceModel.Activation.HttpHandler.ProcessRequest(HttpContext context) +24
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
    
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
    
    
    
    
    解决办法:
    
          <serviceBehaviors>
             <behavior>
               <!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false -->
               <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
               <!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息 -->
               <serviceDebug includeExceptionDetailInFaults="true"/>
             </behavior>
           
           </serviceBehaviors>
    
    
    
    
    
    httpsGetEnabled="true"/ 改为:httpsGetEnabled="false"/ 即可。
  • 相关阅读:
    windows 配置免密登录 centos7
    早盘消息 2月16日 周三
    早报 3月1日 周二
    早报 2月23日 周三
    早报 3月4日 周五
    早报 2月21日 周一
    早盘消息 2月17日 周四
    早报 2月22日 周二
    如何在远程机器上运行多个 SSH 命令并安全退出
    早报 2月28日 周一
  • 原文地址:https://www.cnblogs.com/ChineseMoonGod/p/5585250.html
Copyright © 2020-2023  润新知