小编Pau*_*hra的帖子

IIS8上的WCF;*.svc处理程序映射不起作用

我试图在2012年版本8400上运行IIS8中运行的wcf服务.

在安装web角色时,没有像2008年那样找到wcf的东西(3.51以下).

安装时svc处理程序映射丢失了,所以我做了一个:

%windir%\Microsoft.NET\Framework\v3.0\WindowsCommunication Foundation\ServiceModelReg.exe –i
Run Code Online (Sandbox Code Playgroud)

现在处理程序映射就在那里,但我仍然得到:

The resource you are looking for does not have a handler associated with it.
Run Code Online (Sandbox Code Playgroud)

(我删除了静态文件处理程序.)

该网站使用经典管道以使用模拟.

asp.net wcf iis-8 iis-8.5

264
推荐指数
6
解决办法
20万
查看次数

关于libz.tbd的xcode7 ios9不是目标文件(库中不允许)

错误:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool:file:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0. sdk/usr/lib/libz.tbd不是目标文件(库中不允许)

如果我替换libz.dyliblibz.tbd,xcode显示此错误.我的项目是Cocoa Touch静态库.

ios9 xcode7

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

重命名现有文件名

我有以下代码将文件复制到特定文件夹,然后重命名它.当具有该名称的文件已存在时,我收到以下异常:

Cannot create a file when that file already exists
Run Code Online (Sandbox Code Playgroud)

有没有办法覆盖文件并重命名?或者我应该删除旧的然后更改名称?

这是我的代码:

 File.Copy(FileLocation, NewFileLocation, true);
 //Rename:
 File.Move(Path.Combine(NewFileLocation, fileName), Path.Combine(NewFileLocation, "File.txt"));               
Run Code Online (Sandbox Code Playgroud)

.net c# file-io

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

'T'不包含定义

是否有可能做到以下(如果是这样我似乎无法让它工作..暂时放弃约束)...

如果推断出类型(因为它被省略),那么问题是什么?

private void GetGenericTableContent<T>(ref StringBuilder outputTableContent, T item)
{
    outputTableContent.Append("<td>" + item.SpreadsheetLineNumbers + "</td>");
}

// 'item' is either DuplicateSpreadsheetRowModel class or SpreadsheetRowModel class
Run Code Online (Sandbox Code Playgroud)

使用上面的代码我收到以下错误:

'T'不包含'SpreadsheetLineNumbers'的定义,并且没有扩展方法'SpreadsheetLineNumbers'可以找到接受类型'T'的第一个参数(你是否缺少using指令或汇编引用?)

c# generics

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

无法加载文件或程序集stdole

刚与VS2010并排安装VS2015 ......

有问题的应用程序是使用VS2010(设置为使用.Net 4.0)(未迁移到VS2015)在我的机器上正常工作,将其放在服务器上并在堆中摔倒而构建的... stdole是问题...

在错误Windows日志>应用程序中有一个例外:

Exception information: 
Exception type: ConfigurationErrorsException 
Exception message: Could not load file or assembly 'stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)
   at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
   at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
   at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
   at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
   at System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
   at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) …
Run Code Online (Sandbox Code Playgroud)

.net c# exception stdole

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

实体或复杂类型...不能在LINQ to Entities查询中构造

为什么一个方法可以工作而不是另一个方法,当它们看起来都在做同样的事情时,即构建一个实体.那么我的问题是,有没有办法在L2E查询中构造实体,而不是只使用Linq或两者兼而有之?

这很好......

var queryToList = (from ac in ctx.AuthorisationChecks
                   where wedNumbers.Contains(ac.WedNo)
                   orderby ac.WedNo, ac.ExpAuthDate, ac.ActAuthDate
                   select new AuthorisationCheck
                   {
                       Blah = ac.Blah
                   }).ToList();

model.AuthorisationChecks = queryToList.Select(x => new AuthorisationCheck
    {
        Blah = x.Blah
    }).ToList();
Run Code Online (Sandbox Code Playgroud)

但是,如果我改变......

var queryToList
Run Code Online (Sandbox Code Playgroud)

model.AuthorisationChecks queryToList // Of type List<AuthorisationCheck>
Run Code Online (Sandbox Code Playgroud)

我在标题中得到错误...

The entity or complex type 'Model.AuthorisationCheck' cannot be constructed in a LINQ to Entities query.
Run Code Online (Sandbox Code Playgroud)

编辑: 在模型中它很简单,没有什么花哨的.

public List<AuthorisationCheck> AuthorisationChecks { get; set; }
Run Code Online (Sandbox Code Playgroud)

编辑2: 整理了一点(可行的)...

model.AuthorisationChecks = (from ac in ctx.AuthorisationChecks
                             where wedNumbers.Contains(ac.WedNo)
                             orderby …
Run Code Online (Sandbox Code Playgroud)

c# linq linq-to-entities entity-framework

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

Azure api请求已中止:无法创建SSL/TLS安全通道.http客户端在调用一些web api时

下面的代码在localhost上工作正常,但在microsoft azure上部署我的api后得到上面的错误.

我的代码如下:

public class UsersController : Controller   
{
    private readonly HttpClient _client;

    public UsersController()
    {
        ServicePointManager.Expect100Continue = true;
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
        _client = new HttpClient { BaseAddress = new Uri("https://pincode.saratchandra.in/api") };
        _client.DefaultRequestHeaders.Accept.Clear();
        _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
    }

public JsonResult GetAddress(int pincode)
{
    var response     =_client.GetAsync("/pincode/125112").Result;

    //Here it throws an exception: got no response
    if (response.IsSuccessStatusCode)
    {
    }

    return Json(ApiResult.Success(), JsonRequestBehavior.AllowGet);
}
Run Code Online (Sandbox Code Playgroud)

没有得到任何响应上面的电话只是得到错误

请求已中止:无法创建SSL/TLS安全通道

c# ssl azure dotnet-httpclient

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

在ASP.NET网页中存储数据的最佳实践

我有一组多用户的ASP.NET网页.页面使用AJAX更新面板,因此我可以避免在每次回发时更新屏幕.每个页面的生命周期如下:
1.在Page_Load期间,从Web服务获取用户的相关数据.
2.将数据(非常大)和服务引用存储在静态数据集中.
3.允许通过屏幕控制(网格,文本框)对部分数据进行各种编辑
.4.验证通过表单
5 捕获的数据.将更新的数据发送回服务

我在Page类本身中使用静态变量执行此操作,如下所示:

public partial class MyPage : System.Web.UI.Page
{
    static xxxx.DataCaptureServiceClient  m_Service; //reference to web service
    static string m_PersonID = string.Empty;  //current person_id page is viewing
    static ServResponse m_ServiceResult = null;        // reference to our data to edit ( ServResponse is a large data contract)   
    static string m_SortExpression = "Reference"; //default sort expression for grid

    const int PERSONID_COLUMN = 0;        //column index in grid for the personID column
    const int STATUS_COLUMN = 4;          //column …
Run Code Online (Sandbox Code Playgroud)

c# asp.net

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

AsParallel()如何拆分它的'源'?

我试图确定AsParallel()如何分割它的'source',实际上'source'是什么意思......

例如...

public class CSVItem
{
    public DateTime Date { get; set; }
    public string AccountNumber { get; set; }
}

List<CSVItem> CSVItemList = new List<CSVItem>();
Run Code Online (Sandbox Code Playgroud)

然后将500k不同的CSVItem放入CSVItemList.

然后使用:

CSVItemList = CSVItemList.AsParallel().OrderBy(x => x.AccountNumber).ThenBy(q => q.Date).ToList();
Run Code Online (Sandbox Code Playgroud)

它是否只将'源'(意味着例如250k记录到两个线程中的每一个上)拆分到多个异步线程上并执行OrderBy().然后在每个线程上的ThenBy()合并结果...

或者它将OrderBy()和ThenBy()分离到不同的线程并运行它们然后合并结果...给出一个奇怪的有序列表?

c# multithreading plinq

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

c#每隔200个循环后保存Streamwriter而不关闭

我正在使用StreamWriter将一些数据写入文件.

System.IO.StreamWriter file = new System.IO.StreamWriter(path);
while(something_is_happening && my_flag_is_true)
     file.WriteLine(some_text_goes_Inside);

file.close();
Run Code Online (Sandbox Code Playgroud)

我注意到的是,在关闭之前,没有数据写入文件.

有什么办法可以在关闭之前将内容保存到文件中.

c# file save

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