我试图使用Microsoft.Office.Interop.Excel.Workbook
类将.xls文件转换为服务器端的.xlsx文件,如下所示:
workBook.SaveAs("FILENAME_HERE", XlFileFormat.xlOpenXMLWorkbook, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlNoChange, Microsoft.Office.Interop.Excel.XlSaveConflictResolution.xlLocalSessionChanges, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)). : System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType)
at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType)
at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, …
Run Code Online (Sandbox Code Playgroud) 我有一个Web项目(ASP.NET MVC 4项目),它有许多配置存储在Web.Config和NLog.config文件中.
我有几个发布配置文件PublishProfile1,PublishProfile2等.当使用发布配置文件将我的Web项目部署到服务器时,我想在部署后更改两个配置文件中的一些配置(Web.config中的一些应用程序设置和一些值NLog.config).
我已经按照这里的步骤进行操作,它非常适合更改Web.Config中的设置(例如,Web.PublishProfile1.Config的转换得到尊重).
这是我的 NLog.PublishProfile1.Config转换文件:
<nlog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns="http://www.nlog-project.org/schemas/NLog.xsd">
<nlog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets >
<target xsi:type="File"
name="tracelog"
fileName="NEW_VALUE_HERE" layout="${longdate} [${threadname}::${threadid}] ${pad:padding=5:inner=${level:uppercase=true}} ${logger} - ${message}"
xdt:Transform="Replace" xdt:Locator="Match(name)" />
</targets>
</nlog>
</nlog>
Run Code Online (Sandbox Code Playgroud)
问题是我在NLog.PublishProfile1.config中有相同的转换,但是在部署之后也不会应用这些转换.
有没有人知道为什么这个转换对NLog.config不起作用但对发布配置文件中的Web.config有效?
我正在Visual Studio中开发一个包含许多项目的解决方案:
Solution.sln:
我处理所有项目,当我推动我的VCS(在我的情况下是Github)时,它会触发CI服务器上的构建配置(在我的情况下是TeamCity).TeamCity服务器使用MSBuild,它将Solution.sln作为参数并构建它.但是我希望从构建中忽略某些项目(例如ProjectExc1.csproj,ProjectExc2.csproj).如果我从Solution.sln文件中删除项目引用,我可以执行此步骤,但我认为必须有更好的方法从构建某个项目中排除.
在CI服务器上构建解决方案时,是否有人知道如何配置MSBuild或解决方案本身以忽略这些项目?
我在这里有以下代码:
public async Dictionary<string, float> GetLikelihoodsAsync(List<string> inputs)
{
HttpClient client = new HttpClient();
string uri = GetUri();
string body = GetRequestBody(inputs);
byte[] requestData = Encoding.UTF8.GetBytes(body);
Dictionary<string, float> result = await GetResponseAsync(requestData, client, uri)
.ContinueWith(responseTask => ParseResponseAsync(responseTask.Result))
.ContinueWith(task => task.Result.Result);
return result;
}
Run Code Online (Sandbox Code Playgroud)
同
async Task<HttpResponseMessage> GetResponseAsync(byte[] requestData, HttpClient client, string uri) {...}
async Task<Dictionary<string, float>> ParseResponseAsync(HttpResponseMessage response) {...}
Run Code Online (Sandbox Code Playgroud)
基本上在GetResponseAsync完成之后,我想获取结果并将其提供给ParseResponseAsync并获得包含结果的任务.
目前,它给编译器错误说
异步方法的返回类型必须为void,Task或Task
实现这一目标并消除此错误的最佳方法是什么?其他(更好的解决方案)受到欢迎,并且为什么task.Result.Result在最后的ContinueWith中的一些解释也受到欢迎.
我的解决方案中有许多项目,其中还有一个F#项目.一切都在Visual Studio中构建良好,但是当我尝试在我的TeamCity服务器(没有安装VS)上使用MSBuild构建它时,它会抛出以下构建错误:
C:\TeamCity\buildAgent\work\42c74d8b9d19a844\FSharpEngine\MY_FSHARP_PROJECT.fsproj : error MSB4057: The target "Clean" does not exist in the project.
[16:27:58]Done Building Project "C:\TeamCity\buildAgent\work\42c74d8b9d19a844\Folder0\MY_FSHARP_PROJECT.fsproj" (Clean target(s)) -- FAILED.
[16:27:58]Done Building Project "C:\TeamCity\buildAgent\work\42c74d8b9d19a844\Folder1\REFERENCING_FSHARP_PROJECT.csproj" (Clean target(s)) -- FAILED.
[16:27:58]Done Building Project "C:\TeamCity\buildAgent\work\42c74d8b9d19a844\Folder2\UPPER_REFERENCING_FSHARP_PROJECT.csproj" (Rebuild target(s)) -- FAILED.
[16:27:58]Done Building Project "C:\TeamCity\buildAgent\work\42c74d8b9d19a844\Folder4\UPPER_UPPER_REFERENCING_FSHARP_PROJECT.csproj.metaproj" (Rebuild target(s)) -- FAILED.
[16:27:58]Done Building Project "C:\TeamCity\buildAgent\work\42c74d8b9d19a844\MY_SOLUTION.sln" (Rebuild target(s)) -- FAILED.
[16:27:58]Done Building Project "C:\TeamCity\buildAgent\work\42c74d8b9d19a844\MY_SOLUTION.sln.teamcity" (TeamCity_Generated_Build target(s)) -- FAILED.
Run Code Online (Sandbox Code Playgroud)
我在我的TeamCity服务器上安装了MSBuild工具和F#框架,但我仍然不知道为什么会抛出这个错误.
有人遇到过这个错误,可以给我一些解决方法吗?(我已经失去了一天,但仍然没有运气).
我想使用HTTP PUT请求将一些数据从C++应用程序发送到服务器.我在我的应用程序中使用poco库进行联网.
我正在使用此代码段:
HTTPClientSession session(_uri.getHost(), _uri.getPort());
HTTPRequest req(HTTPRequest::HTTP_PUT, path, HTTPMessage::HTTP_1_1);
Run Code Online (Sandbox Code Playgroud)
发送请求时,我在哪里设置内容(文件)流?有人能告诉我一个使用这个库的例子吗?
我想构建和应用程序,用户可以通过它来输入一些设置,应用程序将启动后台服务以根据这些设置执行某些任务.我想只在模拟器中运行应用程序和后台服务(我知道它需要"认证"模式来运行后台服务,但我现在不想在Firefox Marketplace上发布应用程序).
有人可以提供一些关于如何在FIrefox OS平台上构建和运行后台服务的链接或教程吗?任何人都可以解释如何在后台服务和应用程序之间进行通信吗?(我搜索了MDN和谷歌,但没有运气).
此外,应用程序(常规应用程序或后台服务)是否有某种方式来监听来自服务器的通知?(我正在寻找一种方法,其中应用程序不会汇集,但会被服务器通知).
谢谢你,Tamash
我在SQL Server中有以下表:
ProductAttribute
nvarchar(100)
nvarchar(200)
这是通过Entity Framework映射到我的类:
public class ProductAttribute
{
public string Name {get;set;}
public string Value {get;set;}
}
Run Code Online (Sandbox Code Playgroud)
有些行ProductAttributes
具有以下形式:
{Name: "RAM", Value: "8 GB"}, {Name: "Cache", Value: "3000KB"}
我需要动态构造一个可转换为SQL的ExpressionTree,它可以执行以下操作:
如果值以数字后跟或不是字母数字字符串开头,请提取数字并将其与给定值进行比较
double value = ...;
Expression<Func<ProductAttribute, bool>> expression = p =>
{
Regex regex = new Regex(@"\d+");
Match match = regex.Match(value);
if (match.Success && match.Index == 0)
{
matchExpression = value.Contains(_parserConfig.TokenSeparator) ?
value.Substring(0, value.IndexOf(_parserConfig.TokenSeparator)) :
value;
string comparand = match.Value;
if(double.Parse(comparand)>value)
return true; …
Run Code Online (Sandbox Code Playgroud)我在 IIS 8 中有一个 FTP 网站,我想向公众(未经身份验证的访问者)公开该网站,该网站使用此处的以下设置进行配置:
每当我尝试使用ftp://mysite.com地址从外部连接到网站时,总是会出现一个对话框提示:
需要身份验证 - 服务器ftp://mysite.com:21需要用户名和密码
我已经尝试了所有凭据(即使是对网站指向的文件夹具有读取权限的用户),但仍然没有。Basic Authentication
已为网站禁用。
如何配置 FTP 站点以允许任何访问者进行外部读取访问?
PS:即使使用隐含的解决方案也没关系,Basic Authentication
因为我可以为用户提供服务器上的帐户用于我的目的,但即使Basic Authentication
启用并提供正确的凭据,它也无法进行身份验证。
问候, Ionut
我有一个正在运行的 Web API 2.0 localhost:4512
,我想拦截对域发出的所有请求,localhost:4512
无论它们是否由特定路由处理。例如,我想捕获对localhost:4512/abc.dfsada
或的请求localhost:4512/meh/abc.js
我已经使用 DelegatingHandler 尝试过此操作,但不幸的是,这只拦截对处理的路由发出的请求:
public class ProxyHandler : DelegatingHandler
{
private async Task<HttpResponseMessage> RedirectRequest(HttpRequestMessage request, CancellationToken cancellationToken)
{
var redirectLocation = "http://localhost:54957/";
var localPath = request.RequestUri.LocalPath;
var client = new HttpClient();
var clonedRequest = await request.Clone();
clonedRequest.RequestUri = new Uri(redirectLocation + localPath);
return await client.SendAsync(clonedRequest, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
}
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
return RedirectRequest(request, cancellationToken);
}
}
Run Code Online (Sandbox Code Playgroud)
在 WebConfig.cs 中:
config.MessageHandlers.Add(new ProxyHandler());
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute( …
Run Code Online (Sandbox Code Playgroud) c# ×4
build ×2
msbuild ×2
teamcity ×2
asp.net-mvc ×1
async-await ×1
asynchronous ×1
background ×1
deployment ×1
excel ×1
f# ×1
firefox ×1
firefox-os ×1
ftp ×1
http ×1
iis ×1
iis-7.5 ×1
interop ×1
javascript ×1
mobile ×1
networking ×1
nlog ×1
sql-server ×1
stream ×1
task ×1
web-config ×1
xls ×1
xslt ×1