简体   繁体   English

通过Web服务参考访问类库

[英]Accessing a Class Library through Web Service Reference

I have a C# class library which is consumed in a Web Service (dll is referenced). 我有一个Web服务中使用的C#类库(已引用dll)。 Further the web service is referenced in another ASP.Net project. 此外,在另一个ASP.Net项目中引用了Web服务。 All was working fine until I added a new Class in my Class Library project and updated all the references both in Web Service project and updated the Web Service reference in ASP.Net project. 一切工作正常,直到我在类库项目中添加了新类并更新了Web Service项目中的所有引用并更新了ASP.Net项目中的Web服务引用。 For some unknown reasons to me the newly added class in class library is NOT available in my ASP.Net project through Web Service reference while other old classes are available. 由于某些未知的原因,在类库中新添加的类无法通过Web服务参考在我的ASP.Net项目中使用,而其他旧类也可用。 When I try to access that newly added class in my web service code then its available there but also NOT found in WSDL description of the web service in web browser . 当我尝试访问Web服务代码中新添加的类时,该类可用,但在Web浏览器中Web服务的WSDL描述中找不到。

Please help 请帮忙

I found the reason why the NEW type or Class is not exposed outside the web service. 我发现了未在Web服务外部公开NEW类型或Class的原因。 I was not using the NEW class in any way in my web service hence it was not exposed to outside world.As soon as I created a WebMethod with NEW class in class library as return type it became available everywhere. 我没有在Web服务中以任何方式使用NEW类,因此它不会暴露给外界。当我在类库中创建带有NEW类作为返回类型的WebMethod时,它随处可见。 I didn't know this before so a good learning for me and may be for others as well. 我以前不知道这一点,所以对我来说是一个很好的学习,对其他人也可能是如此。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM