如何解决Plesk 上的 Https WCF
我在 Plesk 上托管了一个 Https WCF 服务,我可以在浏览器上使用 WDSL 文件访问它,但是当我在 WCF 测试客户端中测试该服务时,我收到以下错误: 使用客户端身份验证方案“匿名”禁止 HTTP 请求。 我曾尝试使用 Postman 测试该服务,但得到一个空响应(响应应为 JSON 格式的“成功”)。我在 Plesk 上使用的域由 LetsEncrypt 保护。下面是我的 WCF 配置;
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<!--
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
The following attributes can be set on the <httpRuntime> tag.
<system.Web>
<httpRuntime targetFramework="4.5.2" />
</system.Web>
-->
<system.web>
<compilation targetFramework="4.5.2" defaultLanguage="c#" />
<httpRuntime targetFramework="4.5" />
<customErrors mode="On" />
</system.web>
<system.serviceModel>
<services>
<service name="MyService.MyService" behaviorConfiguration="MyServiceBehavior">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="secureHttpBinding" contract="MyService.IMyService">
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="secureHttpBinding">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<!-- To avoid disclosing metadata information,set the values below to false before deployment -->
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="False" />
<!-- 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="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="netTcpBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<!--
To browse web app root directory during debugging,set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
这是我在 WCF 中的操作合同
[OperationContract]
[WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped,RequestFormat = WebMessageFormat.Xml,Method = "POST",ResponseFormat = WebMessageFormat.Json,UriTemplate = "MyMethod/{Input1},{Input2}")]
string MyMethod(string Input1,string Input2);
我可能做错了什么?或者我需要做什么才能使用该服务?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。