gpt4 book ai didi

jquery - Azure WCF https 404 错误

转载 作者:行者123 更新时间:2023-12-01 01:49:24 24 4
gpt4 key购买 nike

编辑如果我尝试在没有 https 的情况下访问/dowork 的 Web 服务端点,我仍然会收到错误,但它会识别有效的端点。如何启用 HTTPS?

我有一个 WCF 服务,最终主要接收 AJAX 调用以根据用户行为管理状态。

目前我无法取回任何内容,你能看出我哪里出了问题吗?(site/core.svc/dowork 在浏览器和 ajax 中均失败)

[ServiceContract]
public interface Icore
{
[OperationContract]
[WebInvoke(UriTemplate = "/dowork",
BodyStyle = WebMessageBodyStyle.Wrapped,
ResponseFormat = WebMessageFormat.Xml)]
string DoWork();
}

[System.Web.Script.Services.ScriptService]
public class core : Icore
{
public string DoWork()
{
return "hullo";
}
}

<system.web>
<compilation debug="true" targetFramework="4.5"/>
<customErrors mode="Off"/>
<pages controlRenderingCompatibilityVersion="4.0"/>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<bindings>
<webHttpBinding></webHttpBinding>
</bindings>
<services>
<service name="Fusion.core" behaviorConfiguration="Fusion.CoreBehavior" >
<endpoint contract="Fusion.Icore" binding="webHttpBinding" behaviorConfiguration="webBehavior" address="" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Fusion.CoreBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>

最佳答案

您说“site/core.svc/dowork 在浏览器中失败”,这意味着您正在使用 HTTP GET 来访问该服务。但是,您的合约使用 [WebInvoke],它启用 HTTP POST。尝试将 [WebInvoke] 更改为 [WebGet],看看它是否会改变浏览器中的任何内容。

关于jquery - Azure WCF https 404 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13995318/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com