I have a problem in connecting local DB in my web app to run it on iis express.
I developed the application on VS2017 (my os is win10) and to run it on iis I installed sql server 2017 express (until now every thing is ok).
I tested the aap on 2 lap tops have win10 and it is working fine(I installed sqlserver2017exp).
Main pc that I want to run the application on it has win7(not mine) does not supports sqlserver2017exp or 2016 so I installed 2014 but it does not work.
I re-created db by sqlserver2014 and copied it to app_datafolder but I still have same error.
I have lap top has win7 I installed vs2015 to redevelop the application (opened old one and copies code to new one)when I run application by vs2015 I got same error.
I modified web.config many times but I did get correct solution until now.
I need to run application on win7
Error message:
"An attempt to attach an auto-named database for file C:\Users\ITTIHAD FC\Documents\Visual Studio 2015\WebSites\MCL\App_Data\MCL.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share."
Thank you
<configuration>
<system.web>
<globalization culture="en-GB" uiCulture="en-US" fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8"/>
<customErrors mode="Off" defaultRedirect="">
<error statusCode="404" redirect="Default.aspx"/>
</customErrors>
<sessionState mode="InProc" cookieless="false" timeout="20"/>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
<pages>
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages></system.web>
Related
I have a problem concerning the folder strcture of my project, which use SQL Server CE 3.5 (private deploy). The following pic show the folder structure that is fine (no error)
But I wold like to reorganize the folder as follows:
This throws an error, "Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8080. Install the correct version of SQL Server Compact. Refer to KB article 974247 for..."
So I tried to add the probing path in my config file:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="dll"/>
<dependentAssembly xmlns="">
<assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" culture="neutral" />
<bindingRedirect oldVersion="3.5.1.0-3.5.1.50" newVersion="3.5.1.50" />
</dependentAssembly>
</assemblyBinding>
but without success. Is there any chance to force my code to check the required DLL in those folders?
No, this is not possible with the SQL Server Compact 3.5 provider, due to some flaws in the folder detection mechanism for private deployment.
Some improvements with private deployment in version 4.0 should enable this, but I assume you are using version 3.5 for a reason.
In our web application we are using spring, hibernate & sql server 2016 as db. We are using jndi to connect to the database. To record all the queries executed by hibernate I am trying to implement the p6spy.
Here are the changes I have made.
Changed the resource information from
<Resource name="jdbc/eportalcore" auth="Container"
type="javax.sql.DataSource"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost:1433;databaseName=eportal-core;"
username="eportaldbadmin"
password="P#ssw0rd"
maxTotal="100"
maxIdle="20"
minIdle="5"
maxWaitMillis="10000" />
to
<Resource name="jdbc/eportalcore" auth="Container"
type="javax.sql.DataSource"
driverClassName="com.p6spy.engine.spy.P6SpyDriver"
url="jdbc:p6spy:sqlserver://localhost:1433/eportal-core"
username="eportaldbadmin"
password="P#ssw0rd"
maxTotal="100"
maxIdle="20"
minIdle="5"
maxWaitMillis="10000" />
and added the spy.properties file under lib folder of tomcat directory. Also I have placed the p6spy-3.0.0.jar too inside the lib folder.
But after this my application is not getting connected to the DB. What mistake I am doing here? If I remove this changes then it is working fine.
Any suggestions?
I had the same question and here is what I did to make it work. Note my Database connection properties are in a property file (shouldn't be an issue) and that I use tomcat as an Application Server. You can also add P6Spy as a Maven dependency in your project.
Before :
db.properties
db.driver=net.sourceforge.jtds.jdbc.Driver
db.url=jdbc:jtds:sqlserver://${db.server}/${db.name};useNTLMv2=true;domain=XX
After :
Download(latest version when writing this response) the project. Put the p6spy-3.7.0.jar and spy.properties in the tomcat/lib folder. Change the spy.properties and application properties as noted under. Restart application and you should find a spy.log where your logs are printed normally.
db.properties
db.driver=com.p6spy.engine.spy.P6SpyDriver
db.url=jdbc:p6spy:jtds:sqlserver://${db.server}/${db.name};useNTLMv2=true;domain=XX
spy.properties
driverlist=net.sourceforge.jtds.jdbc.Driver
I have SSRS 2012 native mode. I can run Report Builder from localhost where SSRS is installed.
I am unable to run Report Builder from other machines, and I am getting such error:
Downloading http//10.149.100.*/ReportServer/ReportBuilder/ReportBuilder_3_0_0_0.application did not succeed.
The remote server returned an error: (401) Unauthorized.
Here is my scenario:
SSRS is installed on a server which is in a workgroup. There is local user on that server, ie. ruser.
I am accessing report manager from other computer which is in other workgroup/domain using address http//ssrs_server/Reports and I am passing ruser login and password. I can run every report in such way.
But I can't run Report Builder using button in the report manager.
I already tried this instruction http://msdn.microsoft.com/en-us/library/8faf2938-b71b-4e61-a172-46da2209ff55%28v=sql.110%29
and I set Basic Authentication with anonymous access to report builder.
Specifically I performed all steps from 1 to 6 in the section Enabling Anonymous Access to Report Builder Application Files.
The only result was that after I clicked on Report Builder button I received HTTP 500 error instead of HTTP 401.
Then I found out that I can place Report Builder installation files on the IIS and set custom url to the Report Builder. I did it and I could finally run report builder from other machine.
The only problem is that when the Report Builder is run from custom IIS URL then it doesn't connect to report server automatically.
However it is connecting automatically when it is run from default SSRS link.
What I want to achieve is:
either make the Report Builder to be runnable from default SSRS link
either make the Report Builder to be runnable from a custom IIS link (already did it) but also make it automatically connecting to report server.
I found the solution.
The first step is to enable Basic Authentication using this instruction: http://msdn.microsoft.com/en-us/library/8faf2938-b71b-4e61-a172-46da2209ff55%28v=sql.110%29
But I omitted step 4.
Next I used this instruction: https://support.microsoft.com/kb/955809?wa=wsignin1.0
and performed Method 3 - Create an explicit Web.config file
The web.config file need to be saved at this location: C:\Program Files\Microsoft SQL Server\MSRS11.ATC\Reporting Services\ReportServer\ReportBuilder
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation tempDirectory="C:\Program Files\Microsoft SQL Server\MSRS11.ATC\Reporting Services\RSTempFiles\"/>
</system.web>
</configuration>
Because ReportingService is use Windows Authentication .
so you can't use IP Address to link your ReportServer.
i will suggestion use Active Directory Environment in ReportingService.
if you use a normal workgroup. you can try this
1.modify hosts file in C:\Windows\System32\drivers\etc .
map hostnames to IP . Like: win-4mheefkokk4 192.168.179.5
2.change your ReportBuilder URL
From
http: //192.168.179.5/ReportServer/ReportBuilder/ReportBuilder_3_0_0_0.application
To
http:// win-4mheefkokk4/ReportServer/ReportBuilder/ReportBuilder_3_0_0_0.application
Then you can install ReportBuilder by ClickOnce mode. Hope it's can help you :)
The solution to SSRS 2012 - step by step IoI.
https://learn.microsoft.com/en-us/previous-versions/sql/sql-server-2012/cc281309(v=sql.110)?redirectedfrom=MSDN
1 - Verify the report server is configured for Basic authentication by checking the authentication settings in the RSReportServer.config file, below the example:
C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer\rsreportserver.config
<Authentication>
<AuthenticationTypes>
<RSWindowsBasic>
<LogonMethod>3</LogonMethod>
<Realm></Realm>
<DefaultDomain></DefaultDomain>
</RSWindowsBasic>
</AuthenticationTypes>
<RSWindowsExtendedProtectionLevel>Off</RSWindowsExtendedProtectionLevel>
<RSWindowsExtendedProtectionScenario>Proxy</RSWindowsExtendedProtectionScenario>
<EnableAuthPersistence>true</EnableAuthPersistence>
</Authentication>
2 - Create a BIN folder under the ReportBuilder folder. By default, this folder is located at \Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer\ReportBuilder.
3 - Copy the following assemblies from the ReportServer\Bin (C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer\bin) folder
to the ReportBuilder\BIN (C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\ReportingServices\ReportServer\ReportBuilder\bin) folder:
Microsoft.ReportingServices.Diagnostics.dll
Microsoft.ReportingServices.Interfaces.dll
ReportingServicesAppDomainManager.dll
RSHttpRuntime.dll
4- create a Web.config file to process Report Builder requests under an Anonymous account:
C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer\ReportBuilder\Web.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<authentication mode="Windows" />
<identity impersonate="true "/>
</system.web>
</configuration>
Authentication mode must be set to Windows if you include a Web.config file.
Identity impersonate can be True or False.
Set it to False if you do not want ASP.NET to read the security token. The request will run in the security context of the Report Server service.
Set it to True if you want ASP.NET to read the security token from the host layer. If you set it to True, you must also specify userName and password to designate an Anonymous account. The credentials you specify will determine the security context under which the request is issued.
5 - Save the Web.config file to the ReportBuilder\bin folder.
6 - Open RSReportServer.config file (C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer\rsreportserver.config), in the Services section, find IsReportManagerEnabled and add the following setting below it:
<IsReportManagerEnabled>True</IsReportManagerEnabled>
<IsReportBuilderAnonymousAccessEnabled>True</IsReportBuilderAnonymousAccessEnabled>
7 - Save RSReportServer.config and close the file.
8 - Restart the report server.
I keep having a problem running multiple versions of the same solution. I am working on a new release of our Silverlight product, and it's located in a dev branch. Meanwhile I have to fix an issue in the deployed version, located in our maintenance branch.
Whenever I start up a VS (2013) instance of the maintenance version, my dev branch suddenly starts running the maintenance version instead. At least that's what I think is happening, because the UI looks like the maintenance version, and any breakpoint will say that the source file differs from the version built. The only way to get my dev version working again, is to close both VS instances, and open the dev version alone.
Does anyone have a clue what's going on? I have tried a lot of other things as well, but the only thing working is closing both VS instances:
Checked the build configuration
Checked that Silverlight debugging is enabled
Deleted bin/obj folders
Updated the Default.apsx file with so browser cache should be ruled out
UPDATE:
Ok, I found the reason, but not the fix. The project is configured to use IIS express and port 7751:
When I check the applicationhost.config, I found the entry, and it looks something like this:
<site name="ProjectName" id="23">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="xxxxxxxx\dev-branch\project" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:7751:localhost" />
</bindings>
</site>
But I start up the maintenance version of the same solution, the virtual directory immediately changes path to the maintenance version instead (without running the project):
<site name="ProjectName" id="23">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="xxxxxxxx\maintenance-branch\project" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:7751:localhost" />
</bindings>
</site>
So now my question is - how do I ensure that it is possible to run multiple version of the same solution side-by-side?
You should configure the project to run on different ports.
I have a very peculiar issue using Azure Table Storage. I have a .NET 4.5 project in Visual Studio 2012 where I deal with all my Azure Table Storage functions. This project/dll is referenced by two other projects, my MVC website, and my Azure Worker Role. (I am running under the Azure Emulators on my machine, but it also happens when I deploy it to the cloud)
I have the following function that is called when I save or retrieve a record:
internal static CloudTable GetTable(CloudStorageAccount storageAccount, string tableReference)
{
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
CloudTable table = tableClient.GetTableReference(tableReference);
table.CreateIfNotExists();
return tableClient.GetTableReference(table.Name);
}
In my MVC website I have a function that will save a record to a Azure Storage table, and then in my Azure Worker Role there is a service that will read the record.
So both uses the same dll for storage and retrieval, however my MVC project has no issues saving the record, but in my Azure Worker role service when it tries to retrieve the record throws the exception when it attempts to execute "table.CreateIfNotExists();".
Could not load file or assembly 'Microsoft.Data.OData,
Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT:
0x80131040)
I have done the following already:
Updated all the NuGet packages from the solution level to the latest versions
I went through every project reference to make sure that there are no old dll's or previous versions hanging around, in particular the System.Spatial, Microsoft.WindowsAzure.Configuration, Microsoft.WindowsAzure.ServiceRuntime and Microsoft.ServiceBus, Microsoft.WindowsAzure.Storage, Microsoft.Data.Edm & Microsoft.Data.OData
I have even created a new Cloud Service and WorkerRole project from scratch to make sure it is not something in the current WorkerRole project that is broken.
I have not rolled the dll's back to 5.2 as I had too many issues in other projects where I use features that are specific from 5.3 onwards.
I am currently running all the dll's on 5.5.
When I run the AsmSpy.exe utility found here, I get the following output that I am not 100% sure how to interpret.
> Reference: Microsoft.Data.Edm
> 5.5.0.0 by Microsoft.Data.OData
> 5.5.0.0 by Microsoft.Data.Services.Client
> 5.5.0.0 by Microsoft.WindowsAzure.ActiveDirectory.GraphHelper.2013_04_05
> Reference: System.Spatial
> 5.5.0.0 by Microsoft.Data.OData
> 5.5.0.0 by Microsoft.Data.Services.Client Reference: Microsoft.Data.OData
> 5.5.0.0 by Microsoft.Data.Services.Client
> 5.2.0.0 by Microsoft.WindowsAzure.Storage <-- THIS SEEMS TO BE THE ONE THAT IS CAUSING ISSUES
How I interpret it, is that the Microsoft.WindowsAzure.Storage dll is referencing V 5.2.0.0 of the Microsoft.Data.OData dll, but how do I fix this, if this is the issue? According to the documentation I have seen on the Storage dll is that it is supposed to reference 5.4 and up, not 5.2...?
Opening issue for such an easy to solve issue will not help you.
Put the following addition configuration in your respective config files (web.config for the MVC and app.config for the worker role):
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Note that runtime section is direct descendant of the configuration root element! I'm pretty sure you already have this section in your web.config, because MVC4 uses it to rebind all references to System.Web.MVC to the latest version.
I personally do not expect the SDK to be updated with every new version of every referenced library! This would be madness...
I had a very similar problem but in this case it exception message was;
Could not load file or assembly 'Microsoft.Data.OData,
Version=5.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT:
0x80131040)
note it was trying to load v5.5.0.0 of the OData assembly.
After some digging around with ILSpy (http://www.ilspy.net) I discovered that Microsoft.WindowsAzure.Storage 2.0.0.0 was explictly referencing Microsoft.Data.OData 5.2.0.0 - which I didn't have as my version was 5.5.0.0.
So the solution was to use the NuGet package manager to uninstall Microsoft.WindowsAzure.Storage, this inturn uninstalled Microsoft.Data.OData 5.5. Then again using the NuGet package manager, reinstall Microsoft.WindowsAzure.Storage which identified that it needed Microsoft.Data.OData 5.2 and installed that too.
and back to a working solution.
You can solve this issue in general whenever you update packages or add new packages via NuGet and end up with "Could Not Load file or Assembly..." issues.
Open the Package Manager Console (VS 2012 Tools/Library Package Manager/ Package Manager Console). Once the shell opens for the Package Manager Console run the command:
Add-BindingRedirect
Note: Be careful as the NugGet example added an 's' to the end in their example and Add-BindingRedirect is not a valid command.
This does the following:
Examines all assemblies in the output path for a project and adds
binding redirects to the application configuration (app.config) file
or to the web configuration (web.config) file where required.
You can see complete documentation for the Package Manager Console at: http://nuget.codeplex.com/wikipage?title=Package%20Manager%20Console%20Command%20Reference%20(v1.3)
In addition to the two entries you see in astaykov's answer the following was also added for my Project.
<dependentAssembly>
<assemblyIdentity name="System.Spatial" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
</dependentAssembly>
I had similar problem today. The only difference I spotted is my cloud app was looking (and failing to find) for Microsoft.Data.OData in Version=5.2.0.0
Using Visual Studio Object Browser i found out that my solution used library from that location:
C:\Program Files (x86)\Microsoft WCF Data Services\5.0\bin\.NETFramework
Microsoft.Data.OData library residing there was in ver. 5.0.0.0 so overwriting it with 5.2.0.0 resolved the problem.
P.S. I installed WCF Data Services Tools for Windows Store Apps earlier in hope of resolving this issue so it may happen that your application gets it from another source. If that is the case you have two options:
Install WCF Data Services Tools for Windows Store Apps from here and use solution above.
Use Visual Studio Object Browser to find what versions of OData library are currently visible for your project and where they are stored. Next you need to overwrite improper versions of them.
I had a similar problem as well, but I wasn't using Azure and there was no hard-coded reference that was pointing to 5.2. But it resolved (after finding this article) by making sure that the text in the .svc pointed to the correct assembly:
<%# ServiceHost Language="C#"
Factory="System.Data.Services.DataServiceHostFactory,
Microsoft.Data.Services, Version=5.6.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Service="MVC4WCFDataServiceFE5.NorthWindService" %>
Note the Version=5.6.0.0, which I didn't have before.