简体   繁体   English

CS0103:当前上下文中不存在“编码”名称

[英]CS0103: The name 'Encoding' does not exist in the current context

I have a webapplication running on framework 3.5 and is installed on multiple clients, working perfectly. 我有一个在框架3.5上运行的web应用程序,并安装在多个客户端上,运行正常。

Except this one client... where all webservices that the application provide fail with the following error message: 除了这个客户端...应用程序提供的所有Web服务都失败,并显示以下错误消息:

Compilation Error Description: An error occurred during the compilation of a resource required to service this request. 编译错误说明:在编译服务此请求所需的资源期间发生错误。 Please review the following specific error details and modify your source code appropriately. 请查看以下特定错误详细信息并相应地修改源代码。

Compiler Error Message: CS0103: The name 'Encoding' does not exist in the current context 编译器错误消息:CS0103:当前上下文中不存在名称“编码”

Source Error: 来源错误:

Line 100: string EscapedFileName { Line 101: get { Line 102: return HttpUtility.UrlEncode(FileName, Encoding.UTF8); 第100行:字符串EscapedFileName {第101行:获取{第102行:返回HttpUtility.UrlEncode(FileName,Encoding.UTF8); Line 103: } Line 104: } 第103行:}第104行:}

Source File: c:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\CONFIG\\DefaultWsdlHelpGenerator.aspx Line: 102 源文件:c:\\ Windows \\ Microsoft.NET \\ Framework \\ v2.0.50727 \\ CONFIG \\ DefaultWsdlHelpGenerator.aspx行:102

Google points me toward the application might be targeting the client version of the framework or the system missing the system.web dll. 谷歌指出我的应用程序可能是针对框架的客户端版本或缺少system.web dll的系统。

I've checked that both this possibilities are not the cause... Any ideas? 我已经检查过这两种可能性都不是原因......任何想法?

尝试使用System.Text来使用命名空间;

Check your web.config for any <clear /> elements for the namespaces. 检查web.config以获取命名空间的任何<clear />元素。 Also, check your App Pool settings. 另外,请检查您的应用程序池设置。 If possible, can you create a new App Pool and try again? 如果可能,您可以创建一个新的应用程序池并重试吗?

I was able to fix this by locating the DefaultWsdlHelpGenerator.aspx file at the specified path and adding this to the Imports at the top: 我能够通过在指定路径上找到DefaultWsdlHelpGenerator.aspx文件并将其添加到顶部的Imports来解决此问题:

<%@ Import Namespace="System.Text" %>

In my case, I was also seeing a similar error about HtmlUtility not existing, which I was able to fix by adding: 在我的情况下,我也看到了关于HtmlUtility不存在的类似错误,我可以通过添加以下内容来修复:

<%@ Import Namespace="System.Web" %>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 CS0103 名称“txtname”在当前上下文中不存在 - CS0103 the name 'txtname' does not exist in the current context CS0103:名称“ EmailCollections”在当前上下文中不存在 - CS0103: The name 'EmailCollections' does not exist in the current context CS0103:名称“ GetSelectedIndex”在当前上下文中不存在 - CS0103: The name 'GetSelectedIndex' does not exist in the current context CS0103:名称“ rGrid”在当前上下文中不存在 - CS0103: The name 'rGrid' does not exist in the current context CS0103:名称“ rand”在当前上下文中不存在 - CS0103: The name 'rand' does not exist in the current context CS0103:名称“ ClassName”在当前上下文中不存在 - CS0103: The name 'ClassName' does not exist in the current context 错误CS0103:名称“ txtReferralCode”在当前上下文中不存在 - error CS0103: The name 'txtReferralCode' does not exist in the current context Blazor CS0103:“当前上下文中不存在名称‘行’ - Blazor CS0103: "The name 'lines' does not exist in the current context CS0103:该名称在当前上下文中不存在,对于页面中的所有控件? - CS0103: The name does not exist in the current context, For all controls in page? CS0103:名称“ WebApiConfig”在IIS中部署的当前上下文中不存在 - CS0103: The name 'WebApiConfig' does not exist in the current context deployed in IIS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM