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:
Before it was pointing to the namespace, not the class type.
While we had the same issue, our fix was slightly different due to our development environment using windows authentication for some services while specifically disabling it through the web.config.
Needed to comment out/remove the following section of the web.config
This needs to be un-commented for publication to production is the only thing.