小编Shu*_*aib的帖子

使用nginx作为IIS服务器的反向代理

我在一台IIS服务器上运行多个ASP.NET应用程序,每个应用程序都有不同的端口.

我在同一台服务器上安装了nginx,以便我的客户端只能使用端口80访问我的所有应用程序.

Nginx在端口80上运行正常.我的各个ASP.NET应用程序也已启动并运行.

我在nginx conf文件中进行了这些更改

    location /students/ {
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:84;
    }
    location /registration/ {
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:82;
    }
Run Code Online (Sandbox Code Playgroud)

然后我重新启动了nginx并在我的浏览器中输入了URL http://127.0.0.1/students/.Nginx提供了404页面.

我没有对conf文件做任何其他更改.

我做错了什么?

asp.net iis nginx

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

在 RDLC 中动态生成列

我正在尝试在 ASP.NET 中生成 RDLC 报告,其中数据集的列将是动态的并且仅在运行时确定。

我创建了一个返回 DataTable 的函数,通过在 RDLC 报告向导中选择此函数,我可以成功生成报告。

    public DataTable GetTable()
    {
        // Here we create a DataTable with four columns.
        DataTable table = new DataTable();
        table.Columns.Add("Dosage", typeof(int));
        table.Columns.Add("Drug", typeof(string));
        table.Columns.Add("Patient", typeof(string));
        table.Columns.Add("Date", typeof(DateTime));
        table.Columns.Add("testColumn", typeof(DateTime));

        // Here we add five DataRows.
        table.Rows.Add(25, "Indocin", "David", DateTime.Now);
        table.Rows.Add(50, "Enebrel", "Sam", DateTime.Now);
        table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Now);
        table.Rows.Add(21, "Combivent", "Janet", DateTime.Now);
        table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now);
        return table;
    }
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

在此输入图像描述

但是,如果我通过填充数据库中的列对函数进行轻微更改,使我的数据表真正动态,则我的函数不会显示在报告向导中。

这是我改变的功能

    public DataTable GetTable2()
    {
        // Here we create a DataTable …
Run Code Online (Sandbox Code Playgroud)

c# asp.net rdlc reporting-services dynamic-rdlc-generation

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

使用实体框架进行部署后数据库更改的最佳实践

我正在开发一个ASP.NET Web Forms项目,即使在部署之后,该项目也会经历大量的数据库更改.

我们倾向于使用Entity Framework 5和Database First设计范例.但是,由于我们必须在部署之后对数据库进行大量更改,如果我使用数据库优先方法,那么每次更新数据库时,我都必须删除整个模型并重新生成它.是否有任何最佳实践可以减少这个过程的痛苦?

asp.net entity-framework ef-database-first

3
推荐指数
1
解决办法
2799
查看次数

jQuery Datatables AJAX 请求未正确命中 Web API

我正在尝试将ASP.NET Web API 2jQuery Datatables 1.10.7集成。

我想在我的数据表中使用服务器端处理,所以我使用 Nuget 包DataTables.AspNet.WebApi2

这是我的 JavaScript

<script>
    $(document).ready(function () {
        $('#example').dataTable({
            "serverSide": true,
            "ajax": "/api/StudentsBasicInfo/GetPaginatedStudentsList2",
            columns: [
            {
                name: 'FirstName',
                data: 'FirstName',
                title: "First Name",
                sortable: false,
                searchable: false
            },
            {
                name: 'LastName',
                data: "LastName",
                title: "Last Name",
                sortable: false,
                searchable: false
            }
            ]
        });
    });
</script>
Run Code Online (Sandbox Code Playgroud)

这是我的 HTML

<table id="example" class="display" cellspacing="0" width="100%">
</table>
Run Code Online (Sandbox Code Playgroud)

这是我的 Web API

    public JsonResult<IDataTablesResponse> GetPaginatedStudentsList2(IDataTablesRequest request)
    {
        StudentsInfoHybrid searchObj = new StudentsInfoHybrid();

        StudentsBasicInfoBL blClass …
Run Code Online (Sandbox Code Playgroud)

asp.net datatables asp.net-web-api

3
推荐指数
1
解决办法
2388
查看次数

NSString为null,但代码不识别为null

我有这个应用程序,我填充NSDictionary,然后在字典上进行计算.

            tmp = nil;
            tmp = [singleEvent objectForKey:@"start_date"];

            if(tmp == nil)
            {
                startDate = [dateFormatter dateFromString:@"1800/1/1 12:00:00"];
            }
            else
            {
                startDate = [dateFormatter dateFromString:tmp];
            }
Run Code Online (Sandbox Code Playgroud)

tmp是一个NSString对象,而singleEvent是一个NSDictionary.两者都在别处宣布.为简单起见,我没有包含该部分代码.

字典的关键字"start_date"有时会包含字符串格式的日期,有时它将为null.

我已经处理了它将为null的条件,但代码永远不会命中该行.我通过调试发现,即使tmp为null,执行也会转到else部分.

在调试模式下,我在观看tmp时得到这个:

tmp =(NSNull*)

但还是块被击中了. 所以我总是得到一个空指针异常.

objective-c

0
推荐指数
1
解决办法
129
查看次数