将 WebService 属性添加到使用 CodeDom 生成的类

发布于 2024-09-29 07:50:23 字数 299 浏览 1 评论 0原文

我正在使用 CodeDom 为 ASMX Web 服务生成 c-sharp 类,但在向该类添加 Web 服务属性时遇到问题。我试图得到以下最终结果:

[WebService(Namespace = "http://schemas.me.com/mywebservice/", Name = "MyWebService")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class MyWebService : WebService
{
}

I am using CodeDom to generate the c-sharp class for an ASMX webservice, but I'm having trouble adding the web service attributes to the class. I am trying to get the following end-result:

[WebService(Namespace = "http://schemas.me.com/mywebservice/", Name = "MyWebService")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class MyWebService : WebService
{
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

三生一梦 2024-10-06 07:50:23

CodeTypeDeclaration 有一个属性CustomAttributes。如果您添加一个 CodeAttributeDeclaration 到此,您应该没问题。请参阅 http://msdn.microsoft.com/en-us/ Library/system.codedom.codeattributedeclaration.aspx 了解更多信息。

The CodeTypeDeclaration has a property CustomAttributes. If you add a CodeAttributeDeclaration to this, you should be fine. See http://msdn.microsoft.com/en-us/library/system.codedom.codeattributedeclaration.aspx for more information.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文