我在做什么:

开放Visual Studio社区2015 File ->新建->项目 在Visual c#: Web -> ASP下。NET Web应用程序 Web应用程序 并按f5弹出错误“无法连接到web服务器'IIS Express'”。

删除applicationhost。config,位于Documents\IISExpress\config中,不会更改错误消息。(程序文件和程序文件(x86)中也有一个IISExpress文件夹。)

我注意到一件事,我不知道这是不是问题

引用文件'lib/jquery-validation/jquery.validate.js'未找到。

我有一堆破烂,但我没注意到里面有什么。这里有一些内容:

“框架”:{“框架”

我没有注意到问题,但我有网络数据,如果这可以帮助找出为什么我不能连接到web服务器。我立即得到一个RST,ACK,所以我猜端口是关闭的,不管这个web服务器是什么,没有被设置。

关于这个问题的更多信息:800700c1 error from /trace:error

我试过了:

删除applicationhost。配置(和更改端口号) 以管理员身份运行visual studio 删除文档中的IISExpress文件夹(更改错误消息,直到文件夹重新安装) 切换SSL关闭和打开,复制url到启动框。(注意:我没有使用ssl) 清除所有SFC /scannow错误 从x86版本和64位版本启动iisexpress

我正在使用ASP开发一个web服务。NET MVC的新WebAPI将提供二进制文件,主要是。cab和。exe文件。

下面的控制器方法似乎可以工作,这意味着它返回了一个文件,但它将内容类型设置为application/json:

public HttpResponseMessage<Stream> Post(string version, string environment, string filetype)
{
    var path = @"C:\Temp\test.exe";
    var stream = new FileStream(path, FileMode.Open);
    return new HttpResponseMessage<Stream>(stream, new MediaTypeHeaderValue("application/octet-stream"));
}

还有更好的办法吗?

我读了很多关于OWIN和武士刀项目的文章,但我不能得到它的全貌。

对于使用ASP的普通web开发人员。NET:

OWIN到底是什么,它能解决什么问题(简单地说)。它与IIS有什么关系? OWIN会取代IIS吗?如果不是,在什么情况下OWIN最适合? OWIN如何在我的日常工作项目中帮助我? OWIN如何在自我提升项目中帮助我?

我试图让TFS(2013)忽略我的包文件夹。我不希望它源代码控制,因为我正在使用NuGet,它是伟大的!

我尝试了隐身(似乎不工作),我尝试了添加.tfignore文件-没有什么被忽略。为什么TFS团队不像很多Subversion客户端那样添加一个永久忽略文件夹或文件的选项呢?

在J2EE应用程序(例如在WebSphere中运行的应用程序)中,当我使用System.out.println()时,我的文本将转换为标准输出,由WebSphere管理控制台映射到一个文件。

在ASP中。NET应用程序(像一个运行在IIS), Console.WriteLine()的输出去哪里?IIS进程必须有一个stdin, stdout和stderr;但是stdout映射到/dev/null的Windows版本还是我在这里错过了一个关键的概念?

我不是问我是否应该在那里记录日志(我使用log4net),而是问输出到哪里?我最好的信息来自于这个讨论,他们说Console. setout()可以改变TextWriter,但它仍然没有回答控制台的初始值是什么,或者如何在配置/运行时代码之外设置它的问题。

我在我的_Layout.cshtml中定义了这个部分

@RenderSection("Scripts", false)

我可以很容易地从视图中使用它:

@section Scripts { 
    @*Stuff comes here*@
}

我正在努力解决的问题是如何从局部视图将一些内容注入到这个部分中。

让我们假设这是我的视图页面:

@section Scripts { 

    <script>
        //code comes here
    </script>
}

<div>
    poo bar poo
</div>

<div>
  @Html.Partial("_myPartial")
</div>

我需要在脚本部分中从_myPartial partial视图中注入一些内容。

我该怎么做呢?

当我使用一个需要超过30秒才能完成的函数导入时,我使用实体框架(EF)得到超时。我尝试了以下方法,但未能解决此问题:

我将默认命令超时=300000添加到项目中的App.Config文件中的连接字符串中,该文件具有此处建议的EDMX文件。

这是我的连接字符串的样子:

<add 
    name="MyEntityConnectionString" 
    connectionString="metadata=res://*/MyEntities.csdl|res://*/MyEntities.ssdl|
       res://*/MyEntities.msl;
       provider=System.Data.SqlClient;provider connection string=&quot;
       Data Source=trekdevbox;Initial Catalog=StarTrekDatabase;
       Persist Security Info=True;User ID=JamesTKirk;Password=IsFriendsWithSpock;
       MultipleActiveResultSets=True;Default Command Timeout=300000;&quot;"
    providerName="System.Data.EntityClient" />

我尝试在我的存储库中直接设置CommandTimeout,如下所示:

private TrekEntities context = new TrekEntities();

public IEnumerable<TrekMatches> GetKirksFriends()
{
    this.context.CommandTimeout = 180;
    return this.context.GetKirksFriends();
}

我还能做什么来从计时超时中获得EF ?这只发生在非常大的数据集上。对于小型数据集,一切都很好。

这是我得到的错误之一:

entitycommandexecutionexception:在执行命令定义时发生错误。详情请参阅内部异常。——> System.Data.SqlClient.SqlException:超时。操作完成之前的超时时间或服务器没有响应。


好吧,我把它弄好了,发生的事情很愚蠢。我将连接字符串的Default CommandTimeout =300000和CommandTimeout设置为180。当我从连接字符串中删除默认命令超时时,它起作用了。所以答案是在你的存储库中手动设置CommandTimeout在你的context对象上,如下所示:

this.context.CommandTimeout = 180;

显然,在连接字符串中设置超时设置对它没有影响。

我需要在HTTP响应中发送一个CSV文件。如何将输出响应设置为CSV格式?

这是行不通的:

Response.ContentType = "application/CSV";

我只是想知道如何使用Visual Studio(2005)自动增加文件的构建(和版本?)

如果我查找C:\Windows\notepad.exe的属性,版本选项卡给出“文件版本:5.1.2600.2180”。我想在我的dll的版本中也得到这些很酷的数字,而不是版本1.0.0.0,让我们面对它有点沉闷。

我尝试了一些东西,但它似乎没有开箱即用的功能,或者可能我只是在错误的地方(像往常一样)。

我主要工作与网络项目....

我看了两个:

http://www.codeproject.com/KB/dotnet/Auto_Increment_Version.aspx http://www.codeproject.com/KB/dotnet/build_versioning.aspx

我不敢相信花这么大力气做一件事是标准做法。

编辑: 据我所知,它在VS2005中不工作(http://www.codeproject.com/KB/dotnet/AutoIncrementVersion.aspx)

我试图创建一个简单的用户控件,这是一个滑块。当我添加一个AjaxToolkit SliderExtender到用户控件时,我得到这个(*&$#()@#错误:

Server Error in '/' Application. The Controls collection cannot be modified because the control contains code blocks (i.e. `<% ... %>`). Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. `<% ... %>`).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. `<% ... %>`).]    System.Web.UI.ControlCollection.Add(Control child) +8677431    AjaxControlToolkit.ScriptObjectBuilder.RegisterCssReferences(Control control) in d:\E\AjaxTk-AjaxControlToolkit\Release\AjaxControlToolkit\ExtenderBase\ScriptObjectBuilder.cs:293 AjaxControlToolkit.ExtenderControlBase.OnLoad(EventArgs e) in d:\E\AjaxTk-AjaxControlToolkit\Release\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs:306 System.Web.UI.Control.LoadRecursive()
+50    System.Web.UI.Control.LoadRecursive()
+141    System.Web.UI.Control.LoadRecursive()
+141    System.Web.UI.Control.LoadRecursive()
+141    System.Web.UI.Control.LoadRecursive()             
+141    System.Web.UI.Control.LoadRecursive()
+141    System.Web.UI.Control.LoadRecursive()
+141    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627


Version Information: Microsoft .NET Framework Version:2.0.50727.3074; ASP.NET Version:2.0.50727.3074

我尝试在用户控件中放置一个占位符,并以编程方式将文本框和滑块扩展器添加到占位符,但我仍然得到错误。

下面是简单的代码:

<table cellpadding="0" cellspacing="0" style="width:100%">
    <tbody>
        <tr>
            <td></td>
            <td>
                <asp:Label ID="lblMaxValue" runat="server" Text="Maximum" CssClass="float_right" />
                <asp:Label ID="lblMinValue" runat="server" Text="Minimum" />
            </td>
        </tr>
        <tr>
            <td style="width:60%;">
                <asp:CheckBox ID="chkOn" runat="server" />
                <asp:Label ID="lblPrefix" runat="server" />:&nbsp;
                <asp:Label ID="lblSliderValue" runat="server" />&nbsp;
                <asp:Label ID="lblSuffix" runat="server" />
            </td>
            <td style="text-align:right;width:40%;">                

                    <asp:TextBox ID="txtSlider" runat="server" Text="50" style="display:none;" />
                    <ajaxToolkit:SliderExtender ID="seSlider" runat="server" 
                        BehaviorID="seSlider" 
                        TargetControlID="txtSlider" 
                        BoundControlID="lblSliderValue" 
                        Orientation="Horizontal" 
                        EnableHandleAnimation="true" 
                        Length="200" 
                        Minimum="0" 
                        Maximum="100" 
                        Steps="1" />

            </td>
        </tr>
    </tbody>
</table>

有什么问题吗?