如何将Web服务部署为单个dll? C# [英] How to deploy web service as a single dll? C#
问题描述
我在VS类型Site中创建了一个项目。我创建了一堆asmx服务。为了使它在IIS上工作,我只是将cs和asmx文件复制到site的文件夹中。一切都很完美。
现在,当我将服务从本地PC部署到开发服务器时,我被告知要提供一个dll。
我不知道如何在这类项目上编译一个dll。有可能吗?
I've created a project in VS of type Site. I've created a bunch of asmx services. To make it work on IIS, I just copied cs and asmx files to site's folder. Everything works perfect. Now, when it comes to deploy my services from local pc to development server, I was told to deliver a single dll. I don't see how I can compile a dll on this type of project. Is it possible?
然后,我创建了一个ASP.Net项目,将我所有的东西放在那里。它创建了一个单独的dll。但是,如果我把它放在那个文件夹并告诉我的asmx,后面的代码就在那个dll中,当我尝试在浏览器中检查它时,我得到解析错误。
Then, I created an ASP.Net project, put all my stuff there. It created a single dll. But if I put it that folder and tell my asmx, that code behind is in that dll, I get parse error when try to check it in browser.
WebService1.asmx :
WebService1.asmx:
<%@ WebService Language="C#" CodeBehind="~/AllWebServices.dll" Class="MyNamespace.WebService1" %>
也许我需要在Class属性中添加smth?
Maybe I need to add smth in Class attribute?
推荐答案
我在远程服务器上的IIS上部署了Asmx webservices。
I have Asmx webservices deployed on IIS on remote server.
- 右键单击解决方案资源管理器中的项目
- 设置输出类型:
类库
- 构建 - ASMX WebService项目
- 转到项目的
bin文件夹
。你会在那里找到dll。 - 如果你使用过任何
外部dll / libs
并想要一个dll你必须合并它们,使用使用Ilmerge在.NET中组合多个dll -
当我将asmx webservice部署到远程服务器上的IIS时。我只部署
- Right-Click on your project in Solution explorer
- Set Output-type:
Class Library
- Build-ASMX WebService Project
- Go to the
bin folder
of your project. You will find dll's there. - If you have used any
external dlls/libs
and want a single dll you have to merge them, using Using Ilmerge to combine multiple dlls in .NET When I deploy my asmx webservice to IIS on remote server. I deploy only
-
bin
-
webservicename.asmx
-
Web.Config
bin
webservicename.asmx
Web.Config
注意:您无需更改<$ c中的标记$ c> .asmx 您的webservice文件。它会自动在bin文件夹中的 dll中找到它。
Note: You don't need to change the markup in .asmx
file of your webservice. It will automatically find it in the dll in bin folder
.
这篇关于如何将Web服务部署为单个dll? C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!