我在连接到我的WCF服务时遇到问题clientCredentialType="UserName".
当我运行下面的代码时,我收到一个错误
FaultException:验证消息的安全性时发生错误.
当我玩弄一些绑定值时,我也会得到Access is denied..
Fiddler说没有授权标题,我也无法在请求中找到用户名或密码.
以下是我配置的摘录:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<services>
<service name="InventoryServices.MobileAPI" behaviorConfiguration="customBehaviour">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="secureHttpBinding"
contract="InventoryServices.IMobileAPI"/>
<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="customBehaviour">
<serviceSecurityAudit auditLogLocation="Application" serviceAuthorizationAuditLevel="Failure" messageAuthenticationAuditLevel="Failure" suppressAuditFailure="true" />
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to …Run Code Online (Sandbox Code Playgroud) 我有一个ASP.NET核心网站,它依赖于2个类库.
他们都引用了Microsoft.NETCore,但版本已经混淆了,并引导我收到警告:
检测到的软件包降级:Microsoft.NETCore.App从1.1.0升级到1.0.3
NuGet不会让我更改版本Microsoft.NetCore.App:
如果我尝试升级或降级,我会收到错误消息
由于项目或packages.config中的其他约束,以下版本不可用
我该如何解决这个错误?
我的csproj文件:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>AutomotiveWebPortalCore</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>AutomotiveWebPortalCore</PackageId>
<UserSecretsId>aspnet-AutomotiveWebPortalCore-20170223120414</UserSecretsId>
<RuntimeFrameworkVersion>1.0.3</RuntimeFrameworkVersion>
<PackageTargetFallback>$(PackageTargetFallback);dotnet</PackageTargetFallback>
</PropertyGroup>
<ItemGroup>
<Content Update="wwwroot\**\*;Views\**\*;Areas\**\Views;appsettings.json;web.config">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="5.2.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="1.2.0" />
<PackageReference Include="DevExtreme.AspNet.Core" Version="16.2.4" />
<PackageReference Include="DevExtreme.AspNet.Data" Version="1.2.4" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.0.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.0.1" …Run Code Online (Sandbox Code Playgroud) 我正在构建一个业务应用程序,其中读写访问权限很重要.该项目是在Visual Studio 2012中构建的提供商托管的MVC 5/SharePoint应用程序.
约翰尼需要能够Read和AND的Write内容SharePoint App ASharePoint App B
戴夫只需要能够Read满足SharePoint App A
我查看了很多文档,包括本教程:http: //www.itunity.com/article/sharepoint-permissions-manage-access-sql-data-709
问题是,如果我给他在被允许访问站点级别戴夫读访问SharePoint App A也SharePoint App B.
如何有效地使用SharePoint权限来阻止这种意外行为?
我应该使用SharePoint权限吗?
第二个例子:
我正在为项目管理构建一个应用程序,将有一个能够创建,阅读和编辑项目的工程师,还有一个会计师可以查看项目管理.
如果我向工程师授予读取权限并向会计授予读取权限,我如何知道哪些可以查看项目详细信息以及哪些可以查看项目的可计费用?
我为客户开发了一个页面,发生了一些非常奇怪的事情:http: //cpdlectures.com/IStructE/Default.aspx
这个Vimeo视频在Chrome,Mozilla等内部运行.但它在IE中不起作用.
我最初认为它可能是脚本错误或其他什么,所以:
关闭开发人员工具,视频刷新后仍然有效.关闭浏览器,重新打开,再次打破,刷新而不打开开发人员工具,仍然坏了.
什么?Microsoft现在是否在其浏览器中实现了Observer效果?
怎么会这样?
我有一个ASP.NET核心MVC应用程序,在wwwroot文件夹中,我添加了另一个名为"Shaun"的文件夹,在该文件夹中我删除了一个exe来尝试下载:
现在,如果我导航到:http:// localhost:PORT/Shaun/chromesetup.exe我收到404错误.我尝试在下面添加处理程序,但这不起作用.
<add name="Client exe" path="*.exe" verb="*" modules="StaticFileModule" resourceType="File" />
Run Code Online (Sandbox Code Playgroud)
额外信息:我需要这样做的原因是因为我有一个客户端应用程序连接到这个网站,该客户端应用程序使用ClickOnce打包并被放入网站的wwwroot,这以前使用MVC(pre Core)和仍然如此,但没有核心.
我该如何解决?
我有一些linq代码,有时候null:
cbo3.ItemsSource = empty.Union(from a in
(from b in CompleteData
select b.TourOpID).Distinct()
select new ComboBoxItemString() { ValueString = a.Value.ToString() });
Run Code Online (Sandbox Code Playgroud)
但TourOpID有时会null抛出错误a.Value.ToString().我该如何解决这个问题?
我正在尝试设置我的api,以便根据Accept标头响应XML或JSON.
我正在关注Shawn W的教程:https://wildermuth.com/2016/03/16/Content_Negotiation_in_ASP_NET_Core
它说要添加一个包: "Microsoft.AspNet.Mvc.Formatters.Xml": "6.0.0-rc1-final"
但我无法找到它而是安装:
Microsoft.AspNetCore.Mvc.Formatters.Xml
他说要将它添加到Startup中的配置服务部分:
// Add framework services.
services
.AddMvc(options => {
options.RespectBrowserAcceptHeader = true;
options.InputFormatters.Add(new XmlSerializerInputFormatter());
options.OutputFormatters.Add(new XmlSerializerOutputFormatter());
}).AddJsonOptions(options => {
// Force Camel Case to JSON
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
});
Run Code Online (Sandbox Code Playgroud)
然后浏览器自动接收XML,因为默认情况下它使用Accept:text/xml标头,我在浏览器中不使用XML或使用邮递员.无论我将Accept头设置为什么,我都会得到Json.
我试过戴上[Produces("application/xml")]我的控制器,它返回一个空白的200 OK页面.
如何让我的api默认返回Json,如果存在Accept,则返回XML?
编辑1:
我正在使用它作为我的http获取代码:
[HttpGet]
public IActionResult Get() {
var invoices = context.Invoices.ToList();
var mappedInvoices = mapper.Map<List<DomainModels.Invoice>, List<Invoice>>(invoices);
return Ok(mappedInvoices);
}
Run Code Online (Sandbox Code Playgroud)
而我正试图归还这个DTO:
public class Invoice : TrackedObject {
public DateTime Date { get; set; } …Run Code Online (Sandbox Code Playgroud) xml content-negotiation asp.net-web-api http-accept-header asp.net-core
当我的Android设备上的电池死在活动和片段类(如果有的话)用什么方法在设备的"关闭"阶段被称为?
此外,如果用户当前正在查看我的应用程序中的屏幕,并且他们按住电源按钮并选择关闭,那么当电池电量耗尽并自动关闭时,调用/未调用的事件是否一致?
在onPause?
调用OnStop?
的OnDestroy?
OnDetach?
额外奖励:我是否有足够的时间将少量数据保存到Web服务器?
为了澄清当设备的电池"完全"死亡时"死亡",不再接受输入,屏幕上会弹出一个消息框/加载屏幕,显示"电源关闭".设备关闭后不久就会出现.
我只是需要足够的时间来保存手机关机之前的状态,我有一个策略来清理保存的数据,如果手机没有关闭,但我想尽可能接近手机关闭(任何超过一分钟真是无意义).
java android activity-lifecycle android-lifecycle android-activity
我在Windows 8,VS 2012上开始使用PhoneGap时遇到了麻烦,即:
我不知道如何安装模板
我不知道从哪里开始创建我的第一个简单的CRUD应用程序
如何发布允许在许多设备上安装的结果:
我如何开始使用PhoneGap?
我有一个从数据库中获取的匿名类型列表:
var takenChannels = (from b in bq.GetStuff(db)
where b.RecordType == "H" && b.TourStartDateTime.Date == date
select new { Start = b.TourStartDateTime, End = b.TourEndDateTime, Channel = b.RadioChannel, TourArea = b.TourArea }).ToList();
Run Code Online (Sandbox Code Playgroud)
然后我使用这个列表信息在foreach循环中做一些事情.我想在这个列表中添加一个新的匿名项目,当我回到循环中时.
就像是:
takenChannels.Union{new[] { new{Start = DateTime.Now, End = DateTime.Now.AddDays(1), Channel = 25, TourArea = "Area" }});
Run Code Online (Sandbox Code Playgroud)
显然这不起作用.我该怎么做?
编辑1:
takenChannels.Add(new { Start = s, End = e, Channel = channel, TourArea = booking.TourArea });
Run Code Online (Sandbox Code Playgroud)
这是我到目前为止最接近的(感谢丹尼尔)......但我得到的错误是:
错误6参数1:无法从"AnonymousType#2"转换为"AnonymousType#1"
c# ×5
asp.net-core ×3
linq ×2
.net-core ×1
android ×1
asp.net ×1
asp.net-mvc ×1
cordova ×1
download ×1
embed ×1
java ×1
nuget ×1
permissions ×1
sharepoint ×1
sql ×1
vimeo ×1
wcf ×1
xml ×1