1

enter image description hereI recently upgraded my solution from .netframework 4 to 4.7.2 ( It was in VS 2010 and I upgraded it using VS2019) . The solution contains WCF Services and some class library and a mvc 3 website . I had not have issue running my website and it worked without issue . However my other colleagues who got my changes having the following error. The also recently installed VS 2019 and it is strange that I do not have issue but other have, The error is below:

Exception Type: System.ServiceModel.ServiceActivationException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Message: The service '/Reporting/ReportingService.svc' cannot be activated due to an exception during compilation. The exception message is: The CLR Type 'X.Services.Reporting.WebService.ServiceBehaviours.ReportingServiceHostFactory' could not be loaded during service compilation. Verify that this type is either defined in a source file located in the application's \App_Code directory, contained in a compiled assembly located in the application's \bin directory, or present in an assembly installed in the Global Assembly Cache. Note that the type name is case-sensitive and that the directories such as \App_Code and \bin must be located in the application's root directory and cannot be nested in subdirectories.

Stack Trace: System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath, EventTraceActivity eventTraceActivity) System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state) System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped) System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

This makes me think there might be something that I have on my machine and others don't. Any suggestion would be much appreciated.

please note I do not directly use servicehostfactory

public class ReportingServiceHostFactory : UnityServiceHostFactory {....}

This is how my svc file is <%@ ServiceHost Language="C#" Debug="true" Service="X.Services.Reporting.WebService.RepotingService" Factory="X.Services.Reporting.WebService.ServiceBehaviours.ReportingServiceHostFactory"%>

Any help would be much appreciated!

Thanks,

user464291
  • 127
  • 11
  • It turned out that every time people have to remove reference to svc or update it. It even happened to me after I deleted my folder and got the latest version from TFS. How could we fix this so it does not happen every time someone gets a fresh source code for the first time from TFS – user464291 Sep 22 '20 at 16:10
  • 1
    "Verify that this type is either defined in a source file located in the application's \App_Code directory, contained in a compiled assembly located in the application's \bin directory, or present in an assembly installed in the Global Assembly Cache." – Robert Harvey Sep 23 '20 at 18:43
  • I added the image of the issue. The issue has not been resolved yet. It shows errors still (I added the image of error in the original question even for me. Any help would be appreciated. Just a side note my computer is set up with virtual directories . My other colleague published it in release mode into a folder and everything works fine!!! But I do not want to publish every time before debugging – user464291 Sep 23 '20 at 18:46
  • @RobertHarvey how can I verify that? I do not have APP_Code folder – user464291 Sep 23 '20 at 19:17
  • @RobertHarvey I have mvc application and it does not have APP_code, Also i checked global Assembly Cash(C:\Windows\Microsoft.NET\assembly) for Services.Generate.WebService.ServiceBehaviours.GenerateServiceHostFactor and I could not find it there. Am I searching correct? Or i have to do something else? – user464291 Sep 23 '20 at 19:35

1 Answers1

0

I found out what the issue is. The issue is the platform after changing the platform from x86 to AnyCPU in all my projects the issue is fixed. I think the reason is that with x86 platform the debug folder is nested in X*^ folder and that caused the isssue

user464291
  • 127
  • 11