Поделиться через


@ Assembly Directive in XML Web Services

Links an assembly to an XML Web service during compilation, making all the assembly's classes and interfaces available for use by the XML Web service.

<%@ Assembly Name="assemblyname" %>
<%@ Assembly Src="pathname" %>

Attributes

  • Name
    The name of the assembly to link to the XML Web service.

    Note

    The assembly name does not include a file name extension.

  • Src
    The path to a source file to dynamically compile and link against.

    Note

    You cannot include a Name and a Src attribute in the same @ Assembly directive. If you want to use both, you must include more than one directive on the page.

Remarks

The compiler references the assembly at compile time, allowing early binding. Once compilation of the XML Web service is complete, the assembly is dyamically loaded into the application domain when it changes, allowing late binding.

Assemblies that reside in your Web application's \bin directory are automatically linked to XML Web services in that application. Such assemblies do not require the @ Assembly directive.

Note

The path to the assembly or source file in an @ Assembly directive must be a relative path to the Web application hosting the XML Web service.

Example

The following code fragment uses two @ Assembly directives, the first to link to MyAssembly, a user-defined assembly, the second to MySource.vb, a Visual Basic source file located in the src folder beneath the directory of the Web application hosting the XML Web service.

<%@ Assembly Name="MyAssembly" %>
<%@ Assembly Src="src/MySource.vb" %>

See Also

Other Resources

XML Web Services Directives
XML Web Services Using ASP.NET