分析器错误:无法创建类型分析器、错误、类型

由网友(失去你还怕失去什么°)分享简介:我已经创建Web服务,并将其发布在本地计算机上。然后,我已经上传它的服务器。I have created webservice and published it on local machine. Then I have uploaded it on server.现在当我试图访问web服务它提供了以下错误:No...

我已经创建Web服务,并将其发布在本地计算机上。然后,我已经上传它的服务器。

I have created webservice and published it on local machine. Then I have uploaded it on server.

现在当我试图访问web服务它提供了以下错误:

Now while I tried to access webservice it gives following error :

分析器错误信息:无法创建类型webservice.myservice

源错误: 1号线:其中,%@ WebService的语言=C#codeBehind =myservice.asmx.cs级=webservice.myservice%>

Source Error: Line 1: <%@ WebService Language="C#" CodeBehind="myservice.asmx.cs" Class="webservice.myservice" %>

我试过This链接,但未能解决我的问题。

I tried This link but unable to solve my problem.

我应该怎么办?

推荐答案

说不上来,如果这是拖着东西从朦胧和遥远的过去。但是我有这个问题..固定它..所以我想我会分享

Dunno if this is dragging something up from the dim and distant past.. but I had this problem.. fixed it.. so i thought I'd share

当您创建在Visual Studio的Web服务(我使用的是2010年,但我想像它是相同的其他人),它会创建一个名为 Service1.asmx的

When you create a web service in Visual Studio (I'm using 2010 but I'd imagine it's the same for others) it creates a file called Service1.asmx

您会被(不管或)诱惑,它重命名为 MyService.asmx

You'll be tempted to rename it to MyService.asmx (or whatever)

然后,你将看到里面看行

Then you'll look inside and see the line

public class Service1: System.Web.Services.WebService

,你会切换到

which you'll change to

public class MyService: System.Web.Services.WebService

那么,当您试图运行它,你得到错误

then when you try running it you get the error

未能创建类型MyProject.MyService

因为这一切仍然认为该类称为服务1。

cos it still thinks the class is called Service1..

如果你右键点击的.asmx 文件,并选择视图的标记,你会看到它还是说

if you right click the .asmx file and select view markup you'll see it still says

<%@ WebService Language="C#" CodeBehind="MyService.asmx.cs" Class="MyProject.Service1" %>

将其更改为

<%@ WebService Language="C#" CodeBehind="MyService.asmx.cs" Class="MyProject.MyService" %>

保存..试试吧..

save it.. try it..

为我工作。

阅读全文

相关推荐

最新文章