-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathasp.net-web-service-case-sensitivity-issues.html
More file actions
30 lines (24 loc) · 2.38 KB
/
asp.net-web-service-case-sensitivity-issues.html
File metadata and controls
30 lines (24 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
---
layout: layout
title: ASP.Net Web Service Case Sensitivity Issues
---
<div class="post-wrapper">
<h1>Asp.Net Web Service Case Sensitivity Issues</h1>
<p>I have been building Asp.Net Web Services (.asmx) for a while now, and never run into this issue before.</p>
<pre>System.ArgumentException: Invalid method name 'helloworld', method names are case sensitive. The method name 'HelloWorld' with the same name but different casing was found.
Parameter name: methodName
at System.Web.Services.Protocols.HttpServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
</pre>
<p>This happens when invoking the web service method directly from the browser when testing. If you call the service via Scripts everything works fine.</p>
<p>A solution to this problem is to give the methods a <strong>MessageName</strong></p>
<pre style="font-family: Consolas; font-size: 13px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; background-position: initial initial; background-repeat: initial initial;"><<span style="color: #2b91af;">WebMethod</span>(MessageName:=<span style="color: #a31515;">"helloworld"</span>)> _
<span style="color: blue;">Public</span> <span style="color: blue;">Function</span> HelloWorld() <span style="color: blue;">As</span> <span style="color: blue;">String</span>
<span style="color: blue;">Return</span> <span style="color: #a31515;">"Hello World"</span>
<span style="color: blue;">End</span> <span style="color: blue;">Function</span></pre>
<p>The only different is that you are putting the <strong>MessageName</strong> property in lowercase.</p>
<p>Seems to fix the problem, not sure what causes the problem, so I will look into it more.</p>
<p></p>
<p>I am always interested in hearing back from those who read my blog. Please leave a comment if you found this useful, want to suggest any changes to my code, or anything else! Thanks!</p>
</div>