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

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

问题描述

错误:无法生成临时类 (result=1) ... 在 Web 服务上调用方法时.我使用的是 VS 2008 C# ASP.NET 3.5.我正在为我的应用程序调用远程 Web 服务.

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:WINDOWSTEMP6sbkwt2d.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:WINDOWSTEMP6sbkwt2d.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:windowsMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files
oot14127ae496323535App_WebReferences.u9ldrmk1.0.cs    Line:  777

推荐答案

首先,信用到期.OP 解决了这个问题,并在问题的评论部分进行了回答.但是,据我所知,很多人来到 StackOverflow 都会通读问题,而不是看评论.因此,我在此转发上述答案.如果这有用,请务必为这个问题点赞.

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.

出现此问题的原因是与 IIS 中 Web 服务的应用程序池关联的帐户没有对 C:WindowsTemp 文件夹的读/写权限.我不知道为什么该帐户需要访问此文件夹,但确实如此.根据我的随意观察,它看起来只是将一个带有随机名称的空文件写入 Temp 文件夹.

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:WindowsTemp 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.

要解决此问题,请浏览到 C:Windows 文件夹,然后右键单击 Temp 文件夹.选择属性,然后在安全选项卡上添加与您的网络服务应用程序池关联的帐户.点击OK 按钮,转到 IIS 并回收您的应用程序池.这应该可以解决您的 Web 服务请求.

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.

值得注意的是,围绕此错误的情况可能具有一定的欺骗性.5 年多来,我遇到过几次这个问题.(我每次都忘记了.)之所以不那么引人注目,是因为您可以发布 Web 服务,成功浏览到关联的 asmx 页面并查看您的 Web 服务方法的概要.此外,您的 Visual Studio 项目可以添加对 Web 服务的引用,Visual Studio 将自动为您的 VS 项目中的 Web 服务生成所有关联的类.

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.

这给人的印象是一切正常,直到您首次请求在 Web 服务上执行方法.Web 服务在开始执行代码时将失败,因为它想要访问 temp 目录.

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.

有关此错误的更多信息,请参阅 Microsoft.com 上已确认的错误报告.

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

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

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