【问题标题】:IN Flutter Web getting 'XMLHttpRequest' error while making WCF https call在进行 WCF https 调用时,Flutter Web 出现“XMLHttpRequest”错误
【发布时间】:2021-08-06 17:50:14
【问题描述】:

WCF 服务在邮递员和颤振网络中工作 并测试 cors 的起源 https://www.test-cors.org/#?client_method=POST&client_credentials=false&server_url=https%3A%2F%2Fvdent.co%2FVDentPatientRestWs.svc%2Flogin&server_enable=true&server_status=200&server_credentials=false&server_tabs=remote 和ajax调用 在https://resttesttest.com/ 所有工作正常并返回状态 200 但是随着 web 的颤动...返回 xmlhttprequest

【问题讨论】:

  • 您有回复吗?如果您没有取回任何东西,则可能是在请求获得安全身份验证之前执行的 TLS 问题。如果您要返回响应,那么通常它是一个默认的 HTTP 标头,在 c# 和 Postman 之间是不同的。
  • 有详细的错误信息吗?可以参考《Tracing and Message Logging》:docs.microsoft.com/en-us/dotnet/framework/wcf/samples/…

标签: c# flutter wcf xmlhttprequest flutter-web


【解决方案1】:

您可以尝试为您的 webview 提供标题。

   WebView(

               gestureNavigationEnabled: true,

               key: _key,
            
              debuggingEnabled: true,

               javascriptMode: JavascriptMode.unrestricted,


           onWebViewCreated: (WebViewController webViewController) {

             webControl=webViewController;

             _controller.complete(webViewController);

             Map<String, String> header = {'my-header': 'is-this'};
    
             webControl.loadUrl("yourURL",headers: header);

               },
)

(您应该创建 webControl 和 _controller 变量)

【讨论】:

    猜你喜欢
    • 2021-02-04
    • 1970-01-01
    • 1970-01-01
    • 2020-10-15
    • 2021-04-12
    • 1970-01-01
    • 2021-07-19
    • 2022-01-07
    • 2021-11-07
    相关资源
    最近更新 更多