【发布时间】:2017-05-04 11:44:47
【问题描述】:
我创建了一个 WCF 服务,并正在使用 ajax/json 'get' 命令与它通信。它在 Edge、Chrome(Windows 桌面)、Firefox(Windows 桌面)上运行良好。但是有了 IE10,我得到了
XMLHttpRequest: Network Error 0x80070005, Access is denied.
在我的 Android 手机上使用 Chrome,我得到了
error 405 (Method not allowed).
手机上的 Firefox 也失败了(只报告“网络错误”),但我没有任何调试器,因此无法检查潜在错误。 在 iPad 上(使用 Safari),浏览器只是崩溃而没有消息。
首先访问的方法是“登录”,但如果我将其注释掉,请硬编码我的登录详细信息并尝试另一种方法 (GetLocations),我会遇到同样的错误。
该网站是quilkin.co.uk,如果有人想看看。如果它工作正常,如果您尝试登录,您应该得到一个“无效用户”或“无效密码”。是的,我知道它不安全!稍后我会整理。
web.config 如下(格式错误见谅):
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5.2"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- 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="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<handlers>
<remove name="WebDAV"/>
</handlers>
<httpProtocol>
<customHeaders>
<clear />
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept,Authorization" />
<add name="Access-Control-Allow-Methods" value="GET, PUT, POST, ORIGIN" />
</customHeaders>
</httpProtocol>
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule"/>
</modules>
<directoryBrowse enabled="true"/>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>
“WebDAV”删除行是在查看其他帖子后添加的,但似乎没有任何区别。 我还尝试按照here 的描述添加一个新的“global.asax”,但这也没有帮助。
【问题讨论】: