I have created a WCF service using Visual Studio 2010. When i try to run the service, i get the following error
File name: 'file:///H:\Personal\Visual Studio 2010\Projects\WPFBrowser\DatabaseService\bin\Debug\DatabaseService.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolea开发者_运维技巧n suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at Microsoft.Tools.SvcHost.ServiceHostHelper.LoadServiceAssembly(String svcAssemblyPath)
I even tried setting
<configuration>
<runtime>
<loadFromRemoteSources enabled="true" />
</runtime>
</configuration>
in the app.config file, but the problem remains.
Any help will be appreciated....
I think you should take a look at the: "file:///H:\Personal\Visu...". Why the file://? The WCF service should be hosted in the "developer iis" included in Visual Studio. This should result in something like: "http://localhost/abc..."
Moved my solution from the network drive to the local C:\ and it started working fine
精彩评论