.NET网络服务 "Could not create type"

标签 .net web-services

我的 .NET Web 服务的标记和代码隐藏文件内容如下(与 VS 生成的内容差不多):

服务.asmx:

<%@ WebService Language="VB" CodeBehind="Services.asmx.vb" Class="Services" %>

Services.asmx.vb:

Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel

<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class Services
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function HelloWorld() As String
        Return "Hello World"
    End Function
End Class

当我尝试访问网络服务时,我得到:

解析器错误消息:无法创建类型“服务”

我尝试使用命名空间来限定标记中的服务类规范,但无济于事。

当我将隐藏代码与 .asmx 放在同一个文件中时,一切正常。

最佳答案

因此,当我将构建配置更改为“任何 CPU”时,它会起作用,因为包含该类型的 .dll 最终位于 bin 文件夹中。当构建配置设置为 x86 时,.dll 最终仅出现在 bin/x86/Debug 或 bin/x86/Release 中,而 IIS 不会在其中查找。看起来很傻。我错过了什么吗?

关于.NET网络服务 "Could not create type",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3182761/

相关文章:

linux - 优化生产服务器上的图像

Python ThreadingMixin 和 BaseHTTPServer

c# - Mono Assembly 未解决

c# - 如何在逐字字符串中转义“?

C# 编译器优化和 volatile 关键字

php - 将插入的数据[到数据库]发送回应用程序的推荐方法

php webservice不能同时处理多个请求

.net - wpf listview拖动选择多个项目

c# - 为什么.NET 中没有 IDateTimeProvider 而 DateTime 有 Now getter?

java - 更改Web服务中的包名称?