小编Xia*_*Han的帖子

什么是命名空间,soap动作和url应该是我的Android应用程序访问wcf Web服务?

我的WSDL就像:

    <?xml version="1.0" encoding="utf-8"?>
    <wsdl:definitions name="ABCWcfService" targetNamespace="http://www.ABC.com/ABCWcfService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://www.ABC.com/ABCWcfService" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
      <wsdl:types>
        <xsd:schema targetNamespace="http://www.ABC.com/ABCWcfService/Imports">
          <xsd:import schemaLocation="http://desktop/ABCWcfService/ABCWcfService.svc?xsd=xsd0" namespace="http://www.ABC.com/ABCWcfService"/>
          <xsd:import schemaLocation="http://desktop/ABCWcfService/ABCWcfService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
        </xsd:schema>
      </wsdl:types>
      <wsdl:message name="IABCWcfService_GetWhatsOnData_InputMessage">
        <wsdl:part name="parameters" element="tns:GetWhatsOnData"/>
      </wsdl:message>
      <wsdl:message name="IABCWcfService_GetWhatsOnData_OutputMessage">
        <wsdl:part name="parameters" element="tns:GetWhatsOnDataResponse"/>
      </wsdl:message>
      <wsdl:portType name="IABCWcfService">
        <wsdl:operation name="GetWhatsOnData">
          <wsdl:input wsaw:Action="http://www.ABC.com/ABCWcfService/IABCWcfService/GetWhatsOnData" message="tns:IABCWcfService_GetWhatsOnData_InputMessage"/>
          <wsdl:output wsaw:Action="http://www.ABC.com/ABCWcfService/IABCWcfService/GetWhatsOnDataResponse" message="tns:IABCWcfService_GetWhatsOnData_OutputMessage"/>
        </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="BasicHttpBinding_IABCWcfService" type="tns:IABCWcfService">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="GetWhatsOnData">
          <soap:operation soapAction="http://www.ABC.com/ABCWcfService/IABCWcfService/GetWhatsOnData" style="document"/>
          <wsdl:input>
            <soap:body use="literal"/>
          </wsdl:input>
          <wsdl:output>
            <soap:body use="literal"/>
          </wsdl:output>
         </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="ABCWcfService">
        <wsdl:port …
Run Code Online (Sandbox Code Playgroud)

android ksoap2

9
推荐指数
1
解决办法
1万
查看次数

如何在Android中的图像按钮下添加文本?

我想在图像按钮下添加文本,这些文本也是可点击的,并且将被重定向到与图像按钮相同的活动.基本上它就像任何Android手机中的应用程序列表,例如在此输入图像描述

android button imagebutton

8
推荐指数
2
解决办法
2万
查看次数

在 Windows 10 上安装 IIS 7 和 .Net 4.0

我有一个软件,需要安装IIS 7或更高版本以及.Net Framework 4.0或更高版本。

我知道 Windows 10 内置了 IIS 10 和 .Net 4.6,并且我勾选了程序和功能中的所有可用组件。但该软件仍然无法验证环境。

有什么方法可以在 Windows 10 PC 上安装旧版本的 IIS 和/或 .Net,而不用使用 Windows 7 重建系统?

谢谢。

iis .net-framework-version windows-10

5
推荐指数
1
解决办法
2万
查看次数

如何在按钮中传递参数并在后面的代码中获取值,根据windows phone 7中的参数值重定向到另一个页面?

我在想如果windows phone 7按钮事件类似于使用C#的ASP.NET开发,类似于按钮,我在XAML中将值设置为commandparameter,在后面的代码中,我得到命令参数并重定向页面.

我没有找到任何关于按钮事件处理的好例子,有什么建议吗?

谢谢.

parameters button commandparameter windows-phone-7

4
推荐指数
2
解决办法
1万
查看次数

.Net Core 授权与定制要求/处理程序

我之前问过类似的问题,在其他人的帮助下我取得了一些进展,但仍然不确定我在这里做错或错过了什么。

我的应用程序很简单:域用户经过身份验证。经过身份验证的用户(作者)创建一个请求,保存在数据库中。其他经过身份验证的用户只能查看该请求。作者和管理员用户可以编辑/删除请求。

这是我遵循的示例之一: 不同角色的不同 API 功能

另一个 PoliciesAuthApp:https://github.com/aspnet/Docs/tree/master/aspnetcore/security/authorization/policies/samples/PoliciesAuthApp1 我不确定这里如何使用/注册/调用 PermissionHandler 。

这是我的代码:

启动.cs

//  Add Authentication
//  Global filter
services.AddMvc(config =>
{
    var policy = new AuthorizationPolicyBuilder()
                     .RequireAuthenticatedUser()
                     .RequireRole("Role - Domain Users")
                     .Build();
    config.Filters.Add(new AuthorizeFilter(policy));
});


//  Add Authorization Handlers
services.AddAuthorization(options =>
{
    options.AddPolicy("EditPolicy", policy => policy.Requirements.Add(new EditRequirement()));
});

services.AddSingleton<IAuthorizationHandler, PermissionHandler>();
Run Code Online (Sandbox Code Playgroud)

编辑需求.cs

public class EditRequirement : IAuthorizationRequirement
{
}
Run Code Online (Sandbox Code Playgroud)

PermissionHandler.cs

public class PermissionHandler : IAuthorizationHandler
{

    public Task HandleAsync(AuthorizationHandlerContext context)
    {
        var pendingRequirements = context.PendingRequirements.ToList();

        foreach (var requirement in …
Run Code Online (Sandbox Code Playgroud)

asp.net-core-mvc .net-core asp.net-core .net-core-authorization

4
推荐指数
1
解决办法
3549
查看次数

如何在ASP.NET Core 2.x Web应用程序中全局实现基于AD组的授权?

我想知道是否有人可以为我指明一个方向或一个例子,使我获得完整的代码以得到一个总体思路?

谢谢。

更新: 我在Startup.cs中只有以下代码,并确保launchSettings.json中的windowsAutication为true。

public void ConfigureServices(IServiceCollection services)
{
    services.AddMvc();

    services.AddMvc(config =>
    {
        var policy = new AuthorizationPolicyBuilder()
                         .RequireAuthenticatedUser()
                         //.RequireRole(@"Departmental - Information Technology - Development")   // Works
                         .RequireRole(@"*IT.Center of Excellence.Digital Workplace")              // Error
                         .Build();
        config.Filters.Add(new AuthorizeFilter(policy));
    });

}
Run Code Online (Sandbox Code Playgroud)

我想我已启用身份验证,并尝试授权指定AD组中的用户可以在全局级别访问该应用程序。

如果我使用注释的RequireRole可以正常工作,但使用未注释的RequireRole则会给我这个错误:Win32Exception:主域和受信任域之间的信任关系失败。

堆栈的第一行显示:System.Security.Principal.NTAccount.TranslateToSids(IdentityReferenceCollection sourceAccounts,在bool someFailed外)

知道为什么吗?

从上面的更新我的理解

似乎在RequireRole中指定的组名称是电子邮件通讯组列表而不是安全组。如果我使用其他一些AD组,则可以正常工作,但会出现以下新错误:

InvalidOperationException:未指定authenticationScheme,也未找到DefaultForbidScheme。

如果我在Startup.cs的ConfigureServices中添加IIS默认authenticationScheme

services.AddAuthentication(IISDefaults.AuthenticationScheme);
Run Code Online (Sandbox Code Playgroud)

它给了我一个HTTP 403页面:该网站拒绝显示此页面

所以这是最终的代码:

services.AddAuthentication(IISDefaults.AuthenticationScheme);
Run Code Online (Sandbox Code Playgroud)

如果我理解错误,请纠正我。谢谢。

authorization asp.net-authorization asp.net-core asp.net-core-2.0 asp.net-core-mvc-2.0

3
推荐指数
1
解决办法
6664
查看次数

jQuery ajax POST字符串参数,MVC操作方法获取null

我已经在网上看到很多关于此类问题的文章,并尝试了不同的方法,例如JSON.stringify参数,但是它们都不适用于我的情况。

我认为这应该是一种非常简单直接的编码体验。但是无法弄清楚我做错了什么。

这是我的JQuery代码:

$(document).ready(function () {
    $('#SendEmails').click(function () {
        var emails = $("#EmailList").val();     

        $.ajax({
            url: '/Requests/SendEmails',
            type: "POST",
            data: { 'emails': emails },
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (response) {
                alert(response.responseText);
            },
            error: function (response) {
                alert(response.responseText);
            },
            failure: function (response) {
                alert(response.responseText);
            }
        })
    })
})
Run Code Online (Sandbox Code Playgroud)

我的动作方法就像:

[HttpPost]
public string SendEmails(string emails)
{
    return "Good";
}
Run Code Online (Sandbox Code Playgroud)

在调试代码时,我总是在操作方法中得到null。

但是,如果我将网址更改为:

url: '/Requests/SendEmails?emails=' + emails,
Run Code Online (Sandbox Code Playgroud)

并删除

data: { 'emails': emails },
Run Code Online (Sandbox Code Playgroud)

它会工作。

任何人都可以指出原始代码有什么问题吗?我认为.Net Core 2.x不应该有什么不同吗?

谢谢。

ajax asp.net-mvc jquery asp.net-core-mvc asp.net-core-2.0

1
推荐指数
1
解决办法
3024
查看次数