简体   繁体   中英

IIS Error 'Could not find stored procedure 'MyProcedure'

I checked other posts with a similar title, but nothing suggested has worked for me.

Using SQL Server 2014, VS2015 and IIS 8.0.9

Application works perfectly when launched in VS, but fails when deployed to IIS with the above error. The web page contains a drop down box and a start and end date textboxes. User can select hospital from drop down and enter start and end date criteria, click on a button and the results are returned in a gridview control. As I said, this functions perfectly in VS.

When I login to my IIS server, open IIS navigate to my application and select 'browse' from the options and try to navigate to this particular web page, the error is generated. All other functionality works as expected.

What I've tried:

  1. Have checked spelling of stored procedure and it's correct
  2. Have checked login credentials of user in my connection string by logging in to SSMS using same credentials and executing stored procedure. Can do both both.
  3. Checked user permissions to stored procedure. User is a member of 'db_execute' role, which I think is OK
  4. Have checked that login credentials match those in IIS. They do as all other functionality is working and they all use the same login credentials
  5. Have run a SQL Profiler trace. It doesn't find any issues that I can see
  6. Have deleted and re-created the stored procedure a number of times. No change
  7. Have removed the application from IIS and recreated. No change
  8. Have installed on a server running a different version of IIS (6). Same error
  9. Scratched head and ran out of ideas....
  10. Ready to throw computer through window

T-SQL

    @HospitalID INT = NULL,
    @StartSamplingDate DATETIME = NULL,
    @EndSamplingDate DATETIME = NULL
AS
BEGIN
    SET NOCOUNT ON;

    SELECT 
        DNASCreeningID, Surname, Forename, DoB, T21DNAResult, T18DNAResult, 
        T13DNAResult, SamplingDate
    FROM 
        tblPatients
    WHERE 
        (@HospitalID IS NULL OR HospitalID = @HospitalID)
        AND ((@StartSamplingDate IS NULL) OR SamplingDate >= @StartSamplingDate)
        AND ((@EndSamplingDate IS NULL) OR SamplingDate <= @EndSamplingDate)
    ORDER BY 
        DNAScreeningID ASC
END

I'd be grateful for any suggestions or ideas. Thanks.

如果可能,请检查数据库连接您的连接设置为错误的应用程序

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM