WCF could not load reference assemblies from the GAC

I have a WCF service hosted in IIS that is built into Visual Studio. The WCF Services Library refers to several other assemblies that are part of the same Visual Studio solution.

I deploy all the assemblies in the GAC, and then start the service client and see that it is not trying to solve one of the related client assemblies. I added a breakpoint in the WCF service pipeline and does not seem to be trying to load my reference assemblies using qualified names (and therefore does not find them in the GAC). If I run Assembly.Load in the nearest window, after it has been split into a WCF constructor, in IIS I can load each of the missing DLLs using qualified (publicicktoken and such) names.

Why are the CLR or my service library trying to load libraries using only names?

+3
source share
4 answers

Try updating the IIS web application web.config by doing the following

<compilation debug="true">
      <assemblies>
        <add assembly="MyWcfAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=AAAAAAAAAA"/>

From my experience, this is sometimes necessary when the dll is not copied locally and needs to be read from the GAC.

You also need to reload the application domain for your web page in order to use the latest build installed in your GAC. You can reload the domain of your application by running iisreset by touching the web.config or iis manager.

+3
source

GAC , ? , . web.config :

<configuration>
   .......
   <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
     <dependentAssembly>
       <assemblyIdentity name="SomeLibrary" publicKeyToken="31bfe996bd364e76"/>
       <bindingRedirect oldVersion="0.5" newVersion="1.0"/>
     </dependentAssembly>
    </assemblyBinding>
   </runtime>
   ........
</configuration>
0

. - GAC, , , .

IIS reset GAC.

, , .

0

One thing you can try is to use the fully qualified assembly name of your service. I understand that dealing with the GAC is the only way to go.

Alternatively, you can enable Fusion logs to see where your application is trying to download the assembly from and why it is not working. Scott Hanselman has a pretty good tutorial on how to use them.

0
source

Source: https://habr.com/ru/post/1718710/


All Articles