In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, I would like to talk to you about how to solve the relevant WCF Service incident, many people may not know much about it. In order to make you understand better, the editor summarized the following content for you. I hope you can get something according to this article.
Yesterday to today to do a whole day of WCF Service, I am about to collapse!, can no longer be casually shut down, because this time carelessly, almost all the Net installation, debugging problems have been encountered by me, fortunately, I recorded him one by one, at the same time, in the relevant forums to find some relevant solutions, share, for everyone to learn and communicate with each other.
I have a WCF Service hosted on the ASP.NET site, and the physical path looks like "/ MyService/Service.svc". Now, I want to rewrite a URL like "http://localhost/beta/MyService/Service.svc"" to "~ / MyService/Service.svc?ver=beta".
The problems encountered in the first step:
By common sense, it should be overridden in the PostAuthenticateRequest event of HttpApplication. But for requests from .svc, this event is not triggered at all. So I had to rewrite it in the BeginRequest event instead.
The problems encountered in the second step:
After rewriting in BeginRequest, my Service can be accessed correctly through a path like http://localhost/beta/MyService/Service.svc, but when I browse its helper page through IE, the wsdl address is http://localhost/MyService/Service.svc?wsdl, which causes my code to go wrong because I can't recognize the version number.
Similarly, adding a service reference to another test project will not be able to add a reference because of an error in my code. I hope you can give us a plan for using URL rewriting in WCF.
The message contract specification is not used in the previous example. If you use a message contract, you should define a class that represents the message, and then apply the MessageContractAttribute attribute to the class. Then apply the Message Body MemberAttribute, MessageHeaderAttribute, or MessageHeaderArrayAttribute attributes to the members of this class. All of these properties are in System. In the ServieceModel namespace. If you want a high degree of control over the SOAP messages used by the WCF service, do not use the message contract, so it is not discussed in detail here.
If the client application can use a specific type of exception, such as a custom exception, you can apply the System.ServieceModel.FaultContractAttribute attribute to the operation that may generate the exception. You don't want to do this when you initially use WCF.
After reading the above, do you have any further understanding of how to solve the relevant WCF Service incidents? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.