通过Nuget控制台安装此软件包Microsoft.Net.Http时出现此错误:
Install-Package : The 'Microsoft.Net.Http 2.2.28' package requires NuGet client version '2.8.1' or above, but the current NuGet version is '2.6.40627.9000'.
Run Code Online (Sandbox Code Playgroud)
我不能轻易在谷歌上找到任何东西.
我的WPF桌面应用程序也使用WinRT类.
为了做到这一点,我按照本教程 https://software.intel.com/en-us/articles/using-winrt-apis-from-desktop-applications.
很好,它的工作原理.
现在,当我尝试生成msi文件时(我尝试使用Microsoft Installer和ClickOnce),我收到此错误:
问题产生清单.无法加载文件或程序集'C:\ Program Files(x86)\ Windows Kits\8.1\References\CommonConfiguration\Neutral\Windows.winmd'或其依赖项之一.尝试加载格式不正确的程序.
我已经尝试过禁用此处建议的ClickOnce ,清理项目并删除不同.NET框架的ASP.NET临时.
这是我的app.config中的启动标记
我正在使用VS2015和C#如何修复它并生成我的msi?
PS:使用简单的WPF桌面应用程序生成另一个msi没问题.
我正在尝试使用以前在其他应用上使用的以下工作代码打开pdf文件,
但是这次当流程到达这一行时我得到System.Runtime.InteropServices.COMException:Windows.System.Launcher.LaunchFileAsync(pdffile);
这个例外的含义是什么以及如何摆脱它?
请注意,如果不关心此异常(禁用它),
该文件仍然无法打开.
请注意:该文件存在于我的隔离文件夹中(使用wpowertool检查),
我尝试了2个不同的文件,所以它不应该是文件损坏的问题.
public void openFile(string options)
{
System.Diagnostics.Debug.WriteLine("options: " + options);
string optVal = JsonHelper.Deserialize<string[]>(options)[0];
asyncOpen(optVal);
}
public async Task asyncOpen(string filename)
{
filename = filename.Substring(2, filename.Length - 2);
filename = filename.Replace("//", "/").Replace("/", "\\");
Windows.Storage.StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
Debug.WriteLine("local: " + local.Path);
Windows.Storage.StorageFile pdffile = await local.GetFileAsync(filename);
Debug.WriteLine("pdffile: " + pdffile.Name);
//// Launch the pdf file.
Windows.System.Launcher.LaunchFileAsync(pdffile);
}
Run Code Online (Sandbox Code Playgroud)
这个MSDN帖子属于我.是的,文件已安装,我有acrobat阅读器.
请注意,这个C#代码是一个phonegap/cordova插件,在我的混合应用程序中通过javascript调用.
我刚开始使用C#和VS,如何复制我的错误信息.
在下图中我想复制'System.Net.HttpWebRequest ...

我创建了一个饼图chartjs,但是当我点击特定切片时,不会执行click事件.
视图:
<div ng-controller="ProjectsController">
<a>Projects</a>
<br>
</br>
<canvas id="myPieChart" width="600" height="600" ng-click="chartClick()"></canvas>
Run Code Online (Sandbox Code Playgroud)
控制器:
'use strict';
angular.module('Progs')
.controller('ProjectsController', ['$scope', '$rootScope', '$http', '$window', '$state',
function ($scope, $rootScope, $http, $window, $state) {
//...
$scope.chartClick = function (event) {
console.log('chartClick');
//console.log("segment: " + $scope.chart.getSegmentsAtEvent(event));
}
//...
}
Run Code Online (Sandbox Code Playgroud)
我的代码出了什么问题?
请注意:我没有使用 angular-chart.js
我的平板电脑运行Windows 8.1专业版.
它有一个后台任务,每15'由一个时间触发器触发.它很有效,很公平.
问题是我需要在设备的每次启动(启动应用程序)时自动启动后台任务.
我通过以下代码注册了我的bg:
builder.Name = "bikePositionUpdate";
builder.TaskEntryPoint = "BackgroundTaskGps.BikeGPSPositionUpdateBackgroundTask";
builder.SetTrigger(new TimeTrigger(15, false)); //
// adding condition
SystemCondition internetCondition = new SystemCondition(SystemConditionType.InternetAvailable);
SystemCondition userPresentCondition = new SystemCondition(SystemConditionType.UserPresent);
builder.AddCondition(internetCondition);
builder.AddCondition(userPresentCondition);
BackgroundTaskRegistration taskRegistration = builder.Register();
Run Code Online (Sandbox Code Playgroud)
我的应用程序有锁屏访问
await BackgroundExecutionManager.RequestAccessAsync();
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?我错过了什么吗?
我试图通过ajax使用下面的函数从Web服务获取一些数据,但我收到此响应消息:
{"readyState":4, "status":200, "statusText":"load"}
Run Code Online (Sandbox Code Playgroud)
WS应该返回一个json数组,如果我查看网络选项卡中的chrome dev工具 - > Response,我实际上得到了正确的json数组.
题:
function callWebService(wsUrl, params, successFunction, errorFunction) {
$.ajax({
beforeSend: function (xhr) {
xhr.setRequestHeader('Access-Control-Allow-Methods', ' GET');
xhr.setRequestHeader("Content-Type",
"application/json; charset=utf-8");
xhr.setRequestHeader("Accept", "application/json");
},
type: "GET",
url: wsUrl,
data: params,
dataType: "json",
contentType: "application/json",
success: successFunction,
error: errorFunction
});
}
Run Code Online (Sandbox Code Playgroud)
当我使用这个错误函数时,这是我的console.log function(jqXHR, status, error)
*Resource interpreted as Script but transferred with MIME type text/html: "http://www.myweb.it/services/service.php?callback=jQu…y21109160579217132181_1405523828314&codice_istituto=150201&_=1405523828315". jquery.js:8691send jquery.js:8691jQuery.extend.ajax jquery.js:8152callWebService global.js:5(anonymous function) index.js:49jQuery.event.dispatch jquery.js:4409elemData.handle jquery.js:4095
an error occurred: index.js:52
parsererror index.js:53
Error {stack: (...), message: …Run Code Online (Sandbox Code Playgroud) 我的方法是调用Web服务并异步工作.
得到回应时,一切正常,我得到了回应.
当我需要返回此响应时,问题就开始了.
这是我的方法的代码:
public async Task<string> sendWithHttpClient(string requestUrl, string json)
{
try
{
Uri requestUri = new Uri(requestUrl);
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Clear();
...//adding things to header and creating requestcontent
var response = await client.PostAsync(requestUri, requestContent);
if (response.IsSuccessStatusCode)
{
Debug.WriteLine("Success");
HttpContent stream = response.Content;
//Task<string> data = stream.ReadAsStringAsync();
var data = await stream.ReadAsStringAsync();
Debug.WriteLine("data len: " + data.Length);
Debug.WriteLine("data: " + data);
return data;
}
else
{
Debug.WriteLine("Unsuccessful!");
Debug.WriteLine("response.StatusCode: " + response.StatusCode);
Debug.WriteLine("response.ReasonPhrase: " + response.ReasonPhrase); …Run Code Online (Sandbox Code Playgroud) 我试图从angularjs项目中使用Redmine API.
我最终使用jsonp来解决CORS问题.
我打电话给这个时收到404:
var url = 'http://muser:mpasswd@myredmine/issues.json?callback=displayIssues';
$http({
method: 'JSONP',
url: url
}).
success(function (data, status) {
console.log("success");
console.log(data);
}).
error(function (data, status) {
console.log("Error: " + status);
});
...
function displayIssues(issues) {
console.log('displayIssues');
...
}
Run Code Online (Sandbox Code Playgroud)
但是当我用Postman调用相同的URL时,它可以工作.
为什么我收到这个404?
这是我的控制台:
GET http://muser:mpasswd@myredmine/issues.json?callback=displayIssues jsonpReq @ angular.js:8576(anonymous function) @ angular.js:8420sendReq @ angular.js:8291serverRequest @ angular.js:8025wrappedCallback @ angular.js:11498wrappedCallback @ angular.js:11498(anonymous function) @ angular.js:11584Scope.$eval @ angular.js:12608Scope.$digest @ angular.js:12420Scope.$apply @ angular.js:12712(anonymous function) @ angular.js:18980x.event.dispatch @ jquery-2.0.3.min.js:5y.handle @ jquery-2.0.3.min.js:5
authentication.service.js:100 Error: 404
Run Code Online (Sandbox Code Playgroud)
Rest- API和jsonp都在admin-> setting-> auth中启用
我也尝试过: …
我是Cordova和Phonegap的新手,我正在尝试开发一个简单的应用程序,创建一个联系人并在我的Android上运行它(看这个例子)我的手机上加载了我的应用程序,我的应用程序被初始化(事件初始化已经收到)但在任何其他事件之前,我收到这个例外:
05-07 17:52:17.870: E/Web Console(22339): Uncaught module cordova/exec/proxy not found at file:///android_asset/www/cordova.js:55
Run Code Online (Sandbox Code Playgroud)
这是我的index.js
var app = {
// Application Constructor
initialize: function() {
this.bindEvents();
},
// Bind Event Listeners
//
// Bind any events that are required on startup. Common events are:
// 'load', 'deviceready', 'offline', and 'online'.
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
console.log(" bindEvents ...");
},
// deviceready Event Handler
//
// The scope of 'this' is the event. In order to call the 'receivedEvent' …Run Code Online (Sandbox Code Playgroud) c# ×5
javascript ×4
angularjs ×2
.net ×1
ajax ×1
android ×1
async-await ×1
asynchronous ×1
charts ×1
cordova ×1
cordova-3 ×1
jquery ×1
json ×1
jsonp ×1
nuget ×1
redmine-api ×1
wpf ×1