简体   繁体   English

我的asmx Web服务在本地工作,但在远程IIS 7上部署时不工作

[英]My asmx webservice works locally but not when deployed on remote IIS 7

I have developped an asmx webservice with visual studio and I deploy on IIS 7 which has 3.5 Framework by copying all the files. 我已经使用Visual Studio开发了一个asmx Web服务,并通过复制所有文件在具有3.5 Framework的IIS 7上进行了部署。

When testing it says 测试时说

Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. 无法加载文件或程序集'System.Web.Extensions,版本= 1.0.61025.0,区域性=中性,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。 The system cannot find the file specified. 该系统找不到指定的文件。

I don't use [System.Web.Script.Services.ScriptService] so I don't understand why it tries to load System.Web.Extensions. 我不使用[System.Web.Script.Services.ScriptService],所以我不明白为什么它试图加载System.Web.Extensions。

So I change in Visual Studio from .NET 2 to 3.5 but got another error: 所以我在Visual Studio中从.NET 2更改为3.5,但又遇到另一个错误:

Could not load file or assembly 'WebServiceTest' or one of its dependencies. 无法加载文件或程序集“ WebServiceTest”或其依赖项之一。 An attempt was made to load a program with an incorrect format. 试图加载格式错误的程序。

How to fix this ? 如何解决这个问题?

Note: I'm not using any other assembly/lib I'm just learning webservice so it's very simple: I create a webservice Test.asmx with one method which uses one class Test.cs within same namespace WebServiceTest. 注意:我没有使用任何其他程序集/库,我只是在学习Web服务,因此非常简单:我使用一种方法创建了Web服务Test.asmx,该方法在相同名称空间WebServiceTest中使用一个类Test.cs。 This works locally. 这在本地有效。

Finally I have started from scratch again now it works, I think I have mismatched by renaming namespace, class etc. 终于,我再次从头开始,现在可以使用了,我想我通过重命名名称空间,类等不匹配。

Maybe you are using a third party assembly which relies on System.Web.Extensions . 也许您正在使用依赖于System.Web.Extensions第三方程序集。 Make sure this assembly is not referenced in your project either explicitly or implicitly. 确保在您的项目中没有显式或隐式引用此程序集。 Also normally the version of this assembly is 3.5.0.0. 通常,此程序集的版本为3.5.0.0。 From the error message it seems that your project is using version 1.0.61025.0 which is an old version. 从错误消息看来,您的项目正在使用版本1.0.61025.0,这是一个旧版本。 Try looking at every referenced assembly to see what uses this old version. 尝试查看每个引用的程序集,以了解使用此旧版本的程序集。 You might need to deploy it on the target server. 您可能需要将其部署在目标服务器上。

Does the server have web extensions INSTALLED? 服务器是否安装了Web扩展? I think they were an additional install before 4.0. 我认为它们是4.0之前的附加安装。 Or: did you also copy the System.Web.Extensions.dll in the correct version? 或者:您是否还以正确的版本复制了System.Web.Extensions.dll? On your computer it may be in the GAC and not in the bin folder. 在您的计算机上,它可能在GAC中,而不在bin文件夹中。

That said, you should not use that - use WCF to expose web services starting .NET 3.5. 就是说,您不应该使用WCF公开从.NET 3.5开始的Web服务。 you Basically train outdated / retired technology. 您基本上培训过时/淘汰的技术。

暂无
暂无

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

相关问题 Database First DBContext在本地工作,但在部署时无法工作 - Database First DBContext works locally but not when deployed JavaScript在本地运行,但在部署到Web服务器时无法运行 - JavaScript works locally but not when deployed to webserver 简单的WebClient在本地工作,但在部署到Azure时无法工作 - Simple WebClient works locally, but not when deployed to Azure ASP.NET 项目在 VS 运行时在本地运行,但不在本地计算机或服务器上的 IIS 上运行 - ASP.NET project works locally on build when VS is running but not on IIS on my local machine or my server IIS6上的asmx web服务给出404错误 - asmx webservice on IIS6 gives a 404 error 使用 asmx 的简单 helloworld WebService 在 Windows 2008 R2 IIS 7.5 上发布时不起作用 - Simple helloworld WebService using asmx not working when published on Windows 2008 R2 IIS 7.5 具有约束的属性路由在本地工作,但在部署时会失败 - Attribute Route with constraint works locally but fails when deployed ASP.NET Core(HttpSys)路由在本地工作,但在部署时不工作 - ASP.NET Core (HttpSys) Routing works locally but not when deployed 将映像上传到Azure Blob存储-本地工作,部署后失败 - Uplod images to azure blob storage - Works locally, fails when deployed 使用ajax()和jsonp调用asp.net远程Web服务.asmx时出现意外令牌&lt; - unexpected token < when calling asp.net remote webservice .asmx using ajax() and jsonp
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM