错误:无法生成临时类(结果= 1)...当一个Web服务调用方法 [英] Error: Unable to generate a temporary class (result=1) ... When Invoking Methods on a Web Service

查看:639
本文介绍了错误:无法生成临时类(结果= 1)...当一个Web服务调用方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误:无法生成临时类(结果= 1)...当一个Web服务调用方法。我使用VS 2008的C#ASP.NET 3.5。我调用远程web服务我的应用程序。

 在'/'应用程序的服务器错误。
服务器无法处理请求。 --->无法生成临时类(结果= 1)。
错误CS2001:源文件'C:\\ WINDOWS \\ TEMP \\ 6sbkwt2d.0.cs'找不到
错误CS2008:没有指定输入
 说明:执行当前Web请求的执行过程中发生未处理的异常。请查看有关错误的详细信息的堆栈跟踪以及它起源于code。 异常详细信息:System.Web.Services.Protocols.SoapException:服务器无法处理请求。 --->无法生成临时类(结果= 1)。
错误CS2001:源文件'C:\\ WINDOWS \\ TEMP \\ 6sbkwt2d.0.cs'找不到
错误CS2008:没有指定输入
源错误:775线:[System.Web.Services.Protocols.SoapDocumentMethodAttribute(http://tempuri.org/CheckLogin,RequestNamespace =htt​​p://tempuri.org/,ResponseNamespace =htt​​p://tempuri.org/ 使用= System.Web.Services.Description.SoapBindingUse.Literal,ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)
776线:公共System.Data.DataSet中CheckLogin(字符串的uname,串PSWD){
777线:[对象] =结果this.Invoke(CheckLogin,新的对象[] {
778线:UNAME,
779线:PSWD});
 源文件:C:\\ WINDOWS \\ Microsoft.NET \\框架\\ V2.0.50727 \\临时ASP.NET文件\\ ROOT \\ 14127ae4 \\ 96323535 \\ App_WebReferences.u9ldrmk1.0.cs线:777


解决方案

首先,信贷,信贷到期。该任择议定书解决了这一问题和答案它的问题的注释部分。不过,据我了解,很多人前来计算器,并将通过问题阅读,而不是看评论。因此,我在这里转述了上述回答。确保了票的问题,如果这是很有用的。

出现此问题的原因是在IIS Web服务的应用程序池关联的帐户没有读/写权限 C:\\ WINDOWS \\ TEMP 文件夹中。我不知道为什么帐户需要访问这个文件夹,但它确实。从我平时的观察,它看起来像它只是一个随机名称的温度文件夹中写入一个空文件。

要解决这个问题,浏览到 C:\\ WINDOWS 文件夹,并在温度文件夹,右键单击。选择属性安全选项卡上添加与您的Web服务应用程序池关联的帐户。打的确定的按钮,进入IIS和回收您的应用程序池。这应该可以解决您的Web服务请求。

值得注意的是,围绕这个错误的情况下,可能会有点欺骗性。我已经超过5年就遇到了这个问题,几次。 (我每次都忘了。)它之所以不是那么引人注目的是,因为你可以发布一个Web服务,成功浏览到相关的 ASMX 页,看到了你的Web服务方法的轮廓。此外,Visual Studio项目可以添加到Web服务和Visual Studio的引用将自动生成你的VS项目为Web服务相关的所有类别。

这使IM pression直到您对在Web服务上运行的方法你的第一个要求一切工作正常。当它开始执行code,因为它想进入温度目录中的Web服务将失败。

有关该漏洞的更多信息可以在Microsoft.com上的公认 bug报告被发现。

Error: Unable to generate a temporary class (result=1) ... When Invoking Methods on a Web Service. I am using VS 2008 C# ASP.NET 3.5. I am invoking a remote webservice to my application.

Server Error in '/' Application.
Server was unable to process request. ---> Unable to generate a temporary class (result=1).
error CS2001: Source file 'C:\WINDOWS\TEMP\6sbkwt2d.0.cs' could not be found
error CS2008: No inputs specified
 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.Services.Protocols.SoapException: Server was unable to process request. ---> Unable to generate a temporary class (result=1).
error CS2001: Source file 'C:\WINDOWS\TEMP\6sbkwt2d.0.cs' could not be found
error CS2008: No inputs specified


Source Error: 

Line 775:        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CheckLogin", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
Line 776:        public System.Data.DataSet CheckLogin(string uname, string pswd) {
Line 777:            object[] results = this.Invoke("CheckLogin", new object[] {
Line 778:                        uname,
Line 779:                        pswd});


 Source File:  c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\14127ae4\96323535\App_WebReferences.u9ldrmk1.0.cs    Line:  777

解决方案

First, credit where credit is due. The OP solved this problem and answers it in the comments section of the question. However, I understand that many people come to StackOverflow and will read through the question, and not look at the comments. Therefore, I'm relaying the above answer here. Be sure to up-vote the question if this is useful.

This problem occurs because the account that is associated with your web service's application pool in IIS does not have read/write permission to the C:\Windows\Temp folder. I have no clue why the account needs access to this folder, but it does. From my casual observation it looks like it just writes an empty file with a random name to the Temp folder.

To solve this problem browse to the C:\Windows folder, and right-click on the Temp folder. Select Properties, and on the Security tab add the account associated with your web services application pool. Hit the OK button, go to IIS and recycle your application pool. This should fix your web service request.

It is worth noting that the circumstances around this error can be a bit deceptive. I've ran into this problem a couple times over 5 years. (I've forgotten about it each time.) The reason why it's not so noticeable is because you can publish a web service, successfully browse to the associated asmx page and see the outline of your web service methods. Furthermore, your Visual Studio project can add a reference to the Web Service and Visual Studio will auto-generate all associated classes for the web service in your VS project.

This gives the impression that everything is working properly until you make your first request to execute a method on the web service. The web service will fail when it begins executing code because it wants access to the temp directory.

Further information regarding this bug can be found at the acknowledged bug report at Microsoft.com.

这篇关于错误:无法生成临时类(结果= 1)...当一个Web服务调用方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆