I have a WCF web service I wrote which works fine, I then copied the contents of the web service from another application and created a new WCF file which created a new in web.config but the name attribute says the namespace cannot be found.
Here is an example of the first few lines of my WCF:
namespace Testing.ws.mainGrid
{
[WebService(Namespace = "")]
[ScriptService]
[ToolboxItem(false)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Test : WebService
{
[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = true)]
[WebMethod]
public void GetRecords()
{
((NameValueCollection)new WebClient().Headers).Add("accept", "text/xml");
string str1 = "1";
string str2 = "1";
string str3 = "1";
Here is my web.config:
<system.serviceModel>
<services>
<service name="Testing.ws.getStaffTree">
<endpoint address="" behaviorConfiguration="Testing.ws.getStaffTreeAspNetAjaxBehavior"
binding="webHttpBinding" contract="Testing.ws.getStaffTree" />
</service>
<service name="Testing.ws.mainGrid.Test">
<endpoint address="" behaviorConfiguration="Testing.ws.mainGridAspNetAjaxBehavior"
binding="webHttpBinding" contract="Testing.ws.mainGrid" />
</service>
</services>
Basically name="Testing.ws.mainGrid.Test"
does not work and it cannot find it.
I'm not sure what i'm doing wrong but i've spent ages on this! This first works fine but its the second one with the issue.
The actual error is:
the 'name' attribute is invalid - The value Testing.ws.mainGrid.Test is invalid according to its datatype 'serviceNameType' - The enumeration constraint failed
If you let intellisense do its work then it displays the first web service but not my new one!
Your second service should be as follows I think. Note the change in contract name:
<service name="Testing.ws.mainGrid.Test">
<endpoint address="" behaviorConfiguration="Testing.ws.mainGridAspNetAjaxBehavior"
binding="webHttpBinding" contract="Testing.ws.mainGrid.Test" />
</service>
Before it was pointing to the namespace, not the class type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With