Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# [System.Web.Script.Services.ScriptService]在所有情况下都无害吗?_C#_Visual Studio 2010_Web Services_Asmx - Fatal编程技术网

C# [System.Web.Script.Services.ScriptService]在所有情况下都无害吗?

C# [System.Web.Script.Services.ScriptService]在所有情况下都无害吗?,c#,visual-studio-2010,web-services,asmx,C#,Visual Studio 2010,Web Services,Asmx,我正在开发一个web服务,供我们的客户用于特定的处理目的。Visual Studio在我的asmx文件的顶部添加了一行,它告诉我: // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. // [System.Web.Script.Services.ScriptService] 我不确定在哪些不同的场景中,这个web服务将被使用,因此我不能

我正在开发一个web服务,供我们的客户用于特定的处理目的。Visual Studio在我的asmx文件的顶部添加了一行,它告诉我:

// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]
我不确定在哪些不同的场景中,这个web服务将被使用,因此我不能决定对它进行注释或取消注释


我的问题是,在任何情况下取消注释都是无害的,还是这样做可能会导致安全问题?

如果您的代码使用的是.asmx文件,那么请不要更改.asmx文件中的任何内容


因为.asmx文件需要
[System.Web.Script.Services.ScriptService]
。如果您删除此线路,您的服务方法将不会调用并导致错误。

Sir。默认情况下,这一行被注释。我不会使用我的web服务,但我正在为我的客户开发它。web服务在某些情况下肯定会工作,但我不确定删除该注释是否会使web服务在某些情况下可用。