小编mar*_*ela的帖子

Restful WCF 4.0上的IIS 7.5错误

我一直在尝试做一个简单的restful wcf服务,它将返回JSON.它的工作,如果我将在开发服务器中运行它.但是,如果我在IIS 7.5上部署它,当我使用http:// localhost:70访问它时,我将遇到此错误

HTTP错误500.19 - 内部服务器错误无法访问请求的页面,因为页面的相关配置数据无效.

配置错误无法读取配置节'standardEndpoints',因为它缺少节声明

这是我的配置文件:这是VS2010生成的默认文件.

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </modules>
  </system.webServer>

  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <standardEndpoints>
      <webHttpEndpoint>
        <!-- 
            Configure the WCF REST service base address via the global.asax.cs file and the default endpoint 
            via the attributes on the <standardEndpoint> element below
        -->
        <standardEndpoint name="LocationService" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
      </webHttpEndpoint>
    </standardEndpoints>
  </system.serviceModel>

</configuration>
Run Code Online (Sandbox Code Playgroud)

我是WCF的新手,特别是在.net 4.0和IIS 7.5上.

有人可以帮忙吗?或者任何人都经历过同样的事情并且已经修好了?

wcf web-config c#-4.0

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

VB.NET中的显式接口实现

如何在VB.NET中实现显式接口实现?

.net vb.net

13
推荐指数
3
解决办法
3576
查看次数

//maps.google.com/maps/api/js的子资源完整性值

在哪里可以找到脚本的子资源完整性值//maps.google.com/maps/api/js?

例如:

<script src="//maps.google.com/maps/api/js" integrity="sha256-????" crossorigin="anonymous"></script>
Run Code Online (Sandbox Code Playgroud)

google-maps google-maps-api-3 google-cdn subresource-integrity

10
推荐指数
2
解决办法
4136
查看次数

如何知道所有线程池的线程是否已完成其任务?

我有这个应用程序将递归给定目录中的所有文件夹并查找PDF.如果找到PDF文件,应用程序将使用ITextSharp对其页面进行计数.我这样做是通过使用一个线程递归扫描所有文件夹的pdf,然后如果找到PDF,这将排队到线程池.代码如下所示:

//spawn a thread to handle the processing of pdf on each folder.
                var th = new Thread(() =>
                {
                    pdfDirectories = Directory.GetDirectories(pdfPath);
                    processDir(pdfDirectories);
                });
                th.Start();



 private void processDir(string[] dirs)
        {
            foreach (var dir in dirs)
            {
                pdfFiles = Directory.GetFiles(dir, "*.pdf");
                processFiles(pdfFiles);

                string[] newdir = Directory.GetDirectories(dir);
                processDir(newdir);
            }
        }



private void processFiles(string[] files)
        {
            foreach (var pdf in files)
            {
                ThreadPoolHelper.QueueUserWorkItem(
                    new { path = pdf },
                    (data) => { processPDF(data.path); }
                    );
            }
        }
Run Code Online (Sandbox Code Playgroud)

我的问题是,我怎么知道线程池的线程已经完成处理所有排队的项目,所以我可以告诉用户应用程序完成了它的预期任务?

.net c# multithreading threadpool

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

验证jquery中的数字文本字段

我在jquery中有这个代码,以防止非数字字符输入到文本字段

$("#NumericField").numeric();
Run Code Online (Sandbox Code Playgroud)

现在,在文本字段中我无法输入非数字字符.那没问题.这里的问题是用户是否会使用非数字字符粘贴文本字段.

如果值是非数字的,是否有一种方法/方法来禁用粘贴?或者有没有其他方法可以处理这种情况,你可以分享?

asp.net-mvc jquery

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

什么是使用aspnet_compiler.exe预编译ASP.NET项目的优势?

什么是使用aspnet_compiler.exe预编译ASP.NET项目的优势?

此外,编译后的项目是否有可能在部署到远程服务器后出错?团队提出了一个问题,即如果编译项目的机器和将部署项目的服务器将具有不同的设置,则项目将不会运行或错误运行.有人遇到过这种情况吗?

asp.net

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

ASP.NET MVC可以使用带有动态类型参数的参数将JSON对象传递给控制器​​吗?

我的javascript代码,ajax发布数据:

$.ajax({
                url: '/Configurations/GetSelectedPageTranslation',
                type: 'POST',
                data: { inttype: $("#some").val(), objectType:{prop1: 'adsfa', prop2: 'asdf'}},
                success: function (result) {

                },
                error: function () {
                    alert('error');
                }
            });
Run Code Online (Sandbox Code Playgroud)

在控制器中,我有一个带签名的方法:

public JsonResult GetSelectedPageTranslation(int inttype, dynamic objectType)
Run Code Online (Sandbox Code Playgroud)

我可以正确地使用inttype.但是objectType不会为null,但如果我喜欢objectType.prop1,它将抛出错误.如果我将JSON.stringify javascript中的对象类型,控制器中的objectType将具有字符串值.

是否可以使用如下动态数据类型直接访问控制器中的JSON数据:objectType.prop1?

谢谢

ajax jquery json c#-4.0 asp.net-mvc-3

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

ASP.NET MVC路由

这个URL最合适的路线是什么?

www.mysite.com/searchkey0

www.mysite.com/searchkey1
Run Code Online (Sandbox Code Playgroud)

searchkey搜索方法的关键字在哪里?我尝试了以下路线:

routes.MapRoute( _
        "SearchRoute", _
        "search", _
        New With {.controller = "Search", .action = "Search", .id = ""} _
   )
Run Code Online (Sandbox Code Playgroud)

在此路由中,URL必须具有/search/searchkey.我只想要searchkey在URL中,而不是单词Search.

我错过了什么?

asp.net-mvc routing

4
推荐指数
1
解决办法
355
查看次数

jquery - 如何获取div内的html

我有这个html:

<div class="portlet-header">
    Company Information ... <button> some button here </button>
</div>
<div class="portlet-content">
    <div class="content_regular">
        <table style=" width:100%; height:100%;">
            ...content
        </table>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

单击 portlet-header 部分的按钮(在本例中为 table 标记)后,如何获取 html?

我有这个 jquery 代码来获取标题上的文本:$(this).parent().text();但在尝试检索“content_regular”类下的 html 时却无处可去,如上所示。

希望你的智慧能帮助我解决这个问题。我知道这对其他人来说很容易,但我不熟悉jquery。

谢谢

jquery traversal

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

LINQ TO SQL语句生成的SQL查询

我怎么知道我的Linq生成的SQL语句到SQL查询?

linq-to-sql

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