WCF Service in VS.Net 2010 (provided as the Service attribute value in the ServiceHost directive)
-
Tuesday, March 23, 2010 11:54 AM
Hi,
I'm building my first WCF Service in VS.Net 2010 RC on a Win7 Ent 64.
But when I launch my Service (ASP .Net Development Server) for debug and click on the .svc file, I get following error :
The type 'Systemat.Software.Services.PopsyWS.PopsyWebService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
My Project is in the namespace "Systemat.Software.Services.PopsyWS", Assembly Name is "PopsyWebService",Service Name is "PopsyWebService" derived from "IPopsyWebService". All compile options are set on x86.
My code behind is in the file PopsyWebService.svc.cs
My svc file has <%@ ServiceHost Language="C#" Debug="true" Service="Systemat.Software.Services.PopsyWS.PopsyWebService" CodeBehind="PopsyWebService.svc.cs" %>
I also tried PopsyWebService.PopsyWebservice with the same result (stating Type 'PopsyWebService.PopsyWebservice' was not found offcourse)
Pretty sure on of those two is the correct one but neither of them work. Other posts talk about problems with the GAC but I don't think this has anything to do with my problem.
A new empty (example) project of a WCF Service works correctly so it's a project specific problem.
Any idea's ?
My Code : http://rapidshare.com/files/367118782/PopsyWS.zip.html
Thanks in advance,
Sven Peeters
All Replies
-
Thursday, March 25, 2010 6:02 AMModerator
Hi Sven,
I cannot download your project file, my IP address is blocked to download it freely. Could you please upload it to SkyDrive?
Also, try to rename service type or add the assembly name to Service attribute and test if it fix the problem.
Service="Systemat.Software.Services.PopsyWS.PopsyWebService, [assembly]"
Thanks,
Mog Liang- Proposed As Answer by minnymouse Monday, July 16, 2012 11:40 PM
-
Thursday, March 25, 2010 6:24 AMModerator
Hi,
Finally, I download the project freely.
I compare the project with any normal project, found that the project properties->Build->"Output path:" is set to "bin\x86\debug".
When I changed back to "bin\", the project works fine. So, the problems seems that it cannot find the assemlby from folder.
Thanks,
Mog Liang -
Thursday, March 25, 2010 7:46 AM
Hi,
Thank you for the solution, i've added 3 post-build commands :
copy "$(TargetDir)*.dll" "$(ProjectDir)bin"
copy "$(TargetDir)*.pdb" "$(ProjectDir)bin"
copy "$(TargetDir)*.config" "$(ProjectDir)bin"I think this might be considered a bug in VS2010.
Can I ask how you figured this out (trial & error or another method)?
I've encountered another problem now, but before posting I'll try to figure it out myself.
Anyway thank you very much for your input!
- Marked As Answer by Mog LiangModerator Tuesday, March 30, 2010 6:14 AM
-
Tuesday, August 31, 2010 4:26 PM
It's easier to just open the project properties -> Build -> Output Path and make sure it's just "bin\"
MCSD.NET / MCTS- Proposed As Answer by Eduardo_CWB Thursday, March 31, 2011 6:31 PM
-
Thursday, October 07, 2010 12:21 PM
I had the same problem, the solution I found was that I needed to add a reference in the web site project to the WCF project.
Good Luck
Darryl
- Proposed As Answer by kapil tapa Wednesday, February 01, 2012 2:38 AM
-
Monday, March 28, 2011 11:33 AM
Hello Sven,
I dont know if this will help you, but i had same exception, i fixed it by adding the reference of the project that has actual service class which has following attribute
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class ServiceClass : IServiceClass
{
...
...
}
hope this helps
Regards
- Proposed As Answer by Anuj Sethi Monday, December 26, 2011 6:02 AM
-
Thursday, April 14, 2011 10:41 AM
Another possible workaround:
What happened in our project was that the original assembly (web application project) was renamed when the service implementations were moved to a separate project. We forgot to rename the assembly name and root namespace of the website project. As a result, the website project overwrote the assembly with the service implementations. Reflector showed that the Project.Services assembly in the site\bin folder was empty (contained no types), but the build output in the services\bin folder did contain the expected types.
Old situation:
Project.Services (Web application project) (assembly name Project.Services)
Not working situation:
Project.Services (Class Libraray) (assembly name Project.Services)
Project.Services.Site (Web application project) (assembly name Project.Services as the project was renamed)Working situation:
Project.Services (Class Libraray) (assembly name Project.Services)
Project.Services.Site (Web application project) (assembly name Project.Services.Site)We only found out by removing the website project and creating a new project. We then compared the two projects and the missed assembly rename popped up.
- Proposed As Answer by Jesse HouwingMicrosoft Community Contributor Thursday, April 14, 2011 10:41 AM
-
Tuesday, May 17, 2011 9:03 PM
I read this as well as other postings. I followed along with the solution(s) and still have the same problem. I get the original error message posted above.
Here is my .svc file:
<%@ ServiceHost Language="VB" Debug="true" Service="wcfService.MemberEventService" %>
Here is my service:
Imports System Imports System.ServiceModel Namespace wcfService ' <ServiceContract(namespace:="wcfService")> <ServiceContract()> Public Interface IMemberEvent <OperationContract()> Function MemberEventLoad(ByVal EventString As String) As String End Interface Public Class MemberEventService Implements IMemberEvent Public Function MemberEventLoad(ByVal EventString As String) As String Implements IMemberEvent.MemberEventLoad Return "Hello World!" End Function End Class End Namespace
Here is my web.config file:
<?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <services> <service behaviorConfiguration="MemberEventServiceBehavior" name="wcfService.MemberEventService"> <endpoint address="" binding="wsHttpBinding" contract="wcfService.IMemberEvent" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="MemberEventServiceBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> <system.webServer> </system.webServer> </configuration>
Help! I'm pulling my hair out.
-
Wednesday, June 01, 2011 8:05 PM
You need to reference the newly added services project in the References of your startup project.
-
Wednesday, January 25, 2012 8:34 PM
I had same problem i solved,i think all the problems are about the service file path,visual studio makes the service file path with adding the name of (in svc file) service name
and i think service name in the svc file and in class service description are must be same.
Example:
in svc file
:...ServiceHost Language="C#" Factory="System.Data.Services.DataServiceHostFactory" Service="WcfDataService" %>
class:
public class WcfDataService: DataService<WcfDataService>{.....}
if my class name is different(for example: WCFService) URL will be generated like this: "http:\\.....\WcfDataService.svc" and
wcould not find where to go on because of class name,
- Edited by beginning_visual Wednesday, January 25, 2012 8:38 PM
- Proposed As Answer by inoue_dai Saturday, April 14, 2012 5:02 AM
-
Sunday, February 05, 2012 9:58 PM
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)
This fix has actually solved a variety of different error messages I have had with WCF projects.
I always tend to start from the empty project and often find I require this attribute (quite logically) in every service class I create - i guess it should be possible to make a new template class in VS with this attr automagically added?
In this particular case it fixed my problems with not being able to add a service reference hosted in cassini in the current solution to my WPF client. Pretty specific but standard stuff, same old thing fixed it.
- Proposed As Answer by Juanlu, elGuerre Tuesday, March 06, 2012 6:36 PM
- Unproposed As Answer by Juanlu, elGuerre Tuesday, March 06, 2012 6:36 PM
-
Tuesday, March 06, 2012 6:41 PM
Hi,
As Nathan said It's easier to just open the project properties -> Build -> Output Path and make sure it's just "bin\". It's works fine !!!
When you create a new project "WCFService" value of this property is exactly "bin\". I understand that you are starting to debug and old project.
Probably this is a bug for WCFService projects as Sven Peeters said
Regards
Juanlu
JuanLu, elGuerre
-
Sunday, March 25, 2012 3:11 PMAwsome!!! that's worked for me..many thanks....
-
Saturday, April 14, 2012 5:05 AM
I've gotten same error.
But I solved, you beginning_visual's post is the answer for my situation.
Thank you.
-
Saturday, April 14, 2012 5:05 AM
I've gotten same error.
But I solved, you beginning_visual's post is the answer for my situation.
Thank you.
-
Saturday, May 12, 2012 2:49 PM
I am also facing this same error...and doing lot things without result.I changed Bin\Debug\ to Bin\ but still error is getting
In Vs2010,Silverlight4 when i am trying to run the service -view in browser-
i am getting error like
The type 'ESRI_V_10_SIL4.Web.Service2', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
I didnt publish in IIS.In vs2010 i am trying to access the service "view in browser " option.Whether it is my coding pblm or not????can anybdy help me to solve this
<%@ ServiceHost Language="VB" Debug="true" Service="ESRI_V_10_SIL4.Web.Service2" CodeBehind="Service2.svc.vb" %>
web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
</system.web>
<appSettings>
<add key="DBConn" value="Data Source = HUDHUD;Initial Catalog=oman;Integrated Security=True;User Instance=True"/>
</appSettings>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="ESRI_V_10_SIL4.Web.Service2.customBinding0">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<services>
<service name="ESRI_V_10_SIL4.Web.Service2">
<endpoint address="" binding="customBinding" bindingConfiguration="ESRI_V_10_SIL4.Web.Service2.customBinding0"
contract="ESRI_V_10_SIL4.Web.Service2" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
</configuration>
service2.svcImports System.ServiceModel
Imports System.ServiceModel.Activation
Imports System.Collections.Generic
Imports System.Data
Imports System.Data.SqlClient
Namespace ESRI_V_10_SIL4.Web
<ServiceContract(), AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _
Public Class Service2
<OperationContract()> _
Public Function CustomerList() As List(Of testemp)
Dim nwConn As String = System.Configuration.ConfigurationManager.ConnectionStrings("DBConn").ConnectionString
Dim custList = New List(Of testemp)()
Using conn As New SqlConnection(nwConn)
Const sql As String = "Select * from EmpInfo"
conn.Open()
Using cmd As New SqlCommand(sql, conn)
Dim dr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
If dr IsNot Nothing Then
Do While dr.Read()
Dim cust = New testemp With {.EId = dr.GetString(0), .ename = dr.GetString(1)}
custList.Add(cust)
Loop
End If
Return custList
End Using
End Using
End Function
End Class
End Namespace
Please help me....
-
Friday, July 06, 2012 11:47 AM
Try to change namespace in cs and service in svc.. I solved this like said beggining_visual "i think service name in the svc file and in class service description are must be same. " Luck
JM
-
Monday, July 16, 2012 11:42 PM
Great Job, Liang! this resolved my problem which I tried for hours today. Thanks!Hi Sven,
I cannot download your project file, my IP address is blocked to download it freely. Could you please upload it to SkyDrive?
Also, try to rename service type or add the assembly name to Service attribute and test if it fix the problem.
Service="Systemat.Software.Services.PopsyWS.PopsyWebService, [assembly]"
Thanks,
Mog Liang

